Thursday, March 18, 2010

Perl: Detecting two words concatenated into one sepearted by uppercase character

If you are given a word 'textArea' and want to be able to separate them into 'text Area', then here is the perl code to help you achieve it

$item = 'textAreaBuffer';
if($item =~ m/.*?[a-z].*?[A-Z]/){
while($item =~ m/([a-z][A-Z])/g){


print FILE2 substr($item,0,$rem[$count]-1);
print FILE2 " "; }
print FILE2 substr($item,$rem[$count-1]-1,$rem[$count]-$rem[$count-1]);
print FILE2 " ";
print FILE2 substr($item,$rem[@rem-1]-1);
print FILE2 " ";

No comments:

Post a Comment