Reputation: 195
I have two variables
String firstInput = "1.1.5";
String secondInput = "1.1.6";
From this I want the output firstOutput = 115
secondOutput = 116
How to remove dots from the string and concatenate remains as one variable ?
Upvotes: 1
Views: 6937
Reputation: 1697
You can also use replaceAll
with RE
as shown below
void main(){
final myString = '1.3.4.6.6';
String withoutDots = myString.replaceAll(RegExp('\\.'), ''); "Here \\ is used to as esc char"
print(withoutDots); // prints 13466
}
Upvotes: 0
Reputation: 651
You can use the replaceAll method.
It would look like String out = firstInput.replaceAll(".","");
Upvotes: 3