Find IndexOf in C #

How to find indexof()from:

string value = "     50     ";  

There are spaces ... but I do not want to remove them with SubString()or Replace()...

I need to remove the spaces leftindexuntil I get "5"and remove the spaces rightindexafter "0".

+3
source share
6 answers

String.Trim

+9
source

Just use value = value.Trim();and all spaces before and after “50” will disappear.

+5
source

value.Trim().IndexOf(whatever);
+2

, String.Trim(), #

value = value.Trim(); "50"

+1

- jQuery ajax- JSON.

If you are familiar with or used jQuery ajax calls in your code, do not doubt that the following code example looks typical of what you saw earlier:

For more answers, visit this site:

http://net-2-media.com/test/c-indexof

+1
source

just fyi is .trimleft and trimart so you can get "50" or "50" in indecision

0
source

Source: https://habr.com/ru/post/1705650/


All Articles