Home > DeveloperSection > Forums > How to find string starts word in java?
jacob rasel
jacob rasel

Total Post:88

Posted on    October-17-2014 12:41 AM

 Java Java 

 1 Reply(s)
 831  View(s)
Rate this:
Example: This is my string,

String sample = "random";
If the first character of the string contains 's' or 'p' or 'r' means i should remove the character,Otherwise i have to return the original string.

Is there any optimized way to do that like "regex" or "StringUtils" in apache common?

ben reitman
ben reitman

Total Post:96

Posted on    October-17-2014 12:43 AM

Why do you want to add 3rd party jar for this kind of simple requirement? You can try as follows

String sample = "random";
  // do necessary 
  // do necessary 

Don't want to miss updates? Please click the below button!

Follow MindStick