I have the following string values.
00000062178221 00000000054210 00004210555001
How to clear a line and remove zero pads on the left? I am using C # and .net 2.0. Expected results:
62178221 54210 4210555001
It should be pretty effective.
string str = "000001234"; str = str.TrimStart('0');
string s = "0001234"; s = s.TrimStart('0');
You might want to add
if (s == "") s = "0";
to avoid converting 00000000 to an empty string.
00000000
Source: https://habr.com/ru/post/1394135/More articles:Prevent the user from switching to other windows - c #Get function parameter names for interface purposes - javascriptCannot listen / handle EventEmitter in callback - javascriptthis () and this is javaUnable to destroy session in encoder - phpSSLPeerUnverifiedException when creating SSL connection on Android - androidassigned a value, never used, but no compiler message - variablesHow to change Java comment template? - javaBox object type with variable of reference type - c #Save password for connecting ODBC to MS SQL server from MS Access 2007 - ms-accessAll Articles