how to Substring

  • Автор темы Автор темы fredzenno
  • Дата начала Дата начала

fredzenno

Пользователь
Регистрация
27.01.2013
Сообщения
48
Реакции
1
Баллы
8
I need to take the 2 first Numbers on variable Postal. I use substring but is not corectly

var yourText = project.Variables["Postal"].Value;
return project.Variables["departement"].Substring(0,2);

How to make this ?
 
var yourText = project.Variables["Postal"].Value;
return yourText.Substring(0,2);

(C# code)

or you can use a regular expresseion for that (google it)
 
Thank is good

I did not think at Regex, good idea
 
Is possible to change number on C#
For exemple
06 => 6
07 => 7
...
09 > 9

var yourText = project.Variables["Postal"].Value;
=> make change hear
return yourText.Substring(0,2);
 
Do you need to delete all 0?
 
No, just 01, 02, 03, 04 , 04,0 5, 06, 07 08, and 09
 
yourText = yourText.Replace("01","1").Replace("02","2");
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)