Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #52855

Removing camel-case

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject Removing camel-case
Date 2016-11-24 23:23 +0000
Organization Aioe.org NNTP Server
Message-ID <o17sq1$168$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Ruby:

def un_camel_case word
  word.gsub(/(?<=.)[A-Z]/){|c| "_" + c}.downcase
end

Another way:

def un_camel_case word
  word.gsub(/(?<=.)[A-Z]/, '_\0').downcase
end

un_camel_case "STuDlYcApS"
 ===>
"s_tu_dl_yc_ap_s"

In Forth?

-- 
The National Assembly elected a woman named Elizabeth Kopp to be one of seven
members of the Federal Council....  A Swiss journal disclosed the fact that the
woman was a Jewess....  One Jewish publication screamed at the wickedness of
identifying Jews when they were pretending to be Europeans....
jrbooksonline.com/faem/oliver/rpo056.htm

Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Removing camel-case "Robert L." <No_spamming@noWhere_7073.org> - 2016-11-24 23:23 +0000
  Removing camel-case Mark Wills <markwills1970@gmail.com> - 2016-11-24 15:52 -0800

csiph-web