You need to sign in to do that
Don't have an account?

String Theory - A simple challenge - What is the best way to reformat a string?
A little challenge,
I have say 100 strings in a list that are in this format: 3 to 5 numbers, a space, a name.
Example 1: "1234 Product Name One"
Example 2: "12345 Product Name Two"
How do I most efficiently remove the 1234 and the space so I just have Product Name?
Result 1: "Product Name One"
Result 2: "Product Name Two "
I'd do this:
String[] examples = ...//list of product names
List<String> results = new List<String>();
for(String example : examples){
String result = example.substring(example.indexOf(' '));
results.add(result);
}
All Answers
I'd do this:
String[] examples = ...//list of product names
List<String> results = new List<String>();
for(String example : examples){
String result = example.substring(example.indexOf(' '));
results.add(result);
}