If Last Index have space

Hi, some lines have a space in front of ‘.’(the last few digits which is an amount) thus delimiter is being put in. I would like to remove the extra space infront of the dot(in the amount)

E.g.
G Hi Usage 01 ASFpr 2FG018 to 2FG9 ASprfr 20sgf1 633 Messages 3.34
G RSEW SvDESRF Admin Svc (95%) (1 Units) 01 Apr 2018 to 30 Apr 2018 271 .93

E.g.- After delimiter is inserted
G|Hi|Usage|01|ASFpr|2FG018|to|2FG9|ASprfr|20sgf18|633|Messages|3.34
G|RSEW|SvDESRF|Admin|Svc|(95%)|(1|Units)|01|Apr|2018|to|30|Apr|2018|271|.93

Expected:
G|Hi|Usage|01|ASFpr|2FG018|to|2FG9|ASprfr|20sgf18|633|Messages|3.34
G|RSEW|SvDESRF|Admin|Svc|(95%)|(1|Units)|01|Apr|2018|to|30|Apr|2018|271.93

My code:
itemz is the variable for the line.
itemz.LastIndexOf(“.”) < 0 ------> _this code is not working properly. Only suppose to let lines that have space in front of the dot but it lets all line in

itemz.LastIndexOf(“.”)
If: itemz.Substring(deDot - 1, 1) = " "c
itemz.Remove(deDot -1,1)

Any suggestions?

Thank you xoxo

Hi @sangasangasanga,

you can directly replace the string right, can you try like this

For example

strInput.Replace(" .",".")

Regards,
Arivu

2 Likes