mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2010
Posts: 5
D
dvl Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Oct 2010
Posts: 5
Code:
alias capitalize {
  var %x = $lower($1-)
  return $regsubex(%x,/^([a-zA-Zà-ú])|(\s[a-zA-Zà-ú])/g,$upper(\1))
}

alias cap.test { 
  echo -s teste -> $capitalize(test)
  echo -s café -> $capitalize(café)
  echo -s áries -> $capitalize(áries)
}


Result:


Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
alias capitalize {
var %x = $lower($1-)
return $regsubex(%x,/\b([a-zA-Zà-ú])/g,$upper(\t))
}



I am SReject
My Stuff
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
You didn't bother testing that did you?


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Nope :P


I am SReject
My Stuff
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
mIRC passes the input string as a series of UTF-8 encoded bytes to the regex engine, $chr(224) (à) gets encoded to produce $chr(195) $+ $chr(160) (à). you can instruct it to decode this UTF-8 by including (*UTF8) at the very beginning of an expression:

Code:
return $regsubex(%x,/(*UTF8)^([a-zA-Zà-ú])|(\s[a-zA-Zà-ú])/g,$upper(\1))


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2010
Posts: 5
D
dvl Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Oct 2010
Posts: 5
hm, interesting, I didnt know about (*UTF8), thanks guys for the help.


Link Copied to Clipboard