Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex ucase replacement
#1
Hey folks...been a while and I hope y'all are doing swell!

Trying to camel case some text by removing spaces and capitalizing the letter that comes afterwords:

Function camelCase
Code:
Copy      Help
str Text="hello world"
Text.replacerx(" (.{1})" "\u$1")
out Text

I found this stackoverflow page that shows using the "\u" sort of thing, but in QM it outputs "hello\uworld" instead of "helloWorld"
https://stackoverflow.com/questions/2074...s/20742304

This works...but it's not very pretty:
Function camelCase
Code:
Copy      Help
str s="hello world"
REPLACERX r
r.frepl=&sub.replacerx_callback
s.replacerx(" (.{1})" &r)
out s

#sub replacerx_callback
function# REPLACERXCB&x
x.match.trim
x.match.ucase


Messages In This Thread
Regex ucase replacement - by TheVig - 11-11-2021, 02:50 PM
RE: Regex ucase replacement - by Gintaras - 11-11-2021, 08:32 PM
RE: Regex ucase replacement - by TheVig - 11-12-2021, 09:57 PM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 12:56 AM
RE: Regex ucase replacement - by Kevin - 09-11-2022, 01:08 AM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 02:54 AM
RE: Regex ucase replacement - by Kevin - 09-11-2022, 03:25 AM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 03:37 AM
RE: Regex ucase replacement - by Kevin - 09-11-2022, 03:44 AM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 03:56 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)