how to del the Invisible space in the text (or in the variables)?

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

coolbb

Client
Регистрация
06.09.2013
Сообщения
95
Реакции
0
Баллы
6
i want copy the text (no space in it )to the cmd for run, but there is a visible space after it paste to the cmd widow , how to sovle it??

even i put it to the variables then run the program, the space still invisible in the variable but visible in the program window, how to del the space before run??
 

Вложения

  • test.txt
    test.txt
    27 байт · Просмотры: 132
  • 2022-06-15_103609.png
    2022-06-15_103609.png
    26,2 KB · Просмотры: 157
Последнее редактирование:
Transform your text in "Word list" and "trim" (they are in "text processing")
 
i check , it cant solue the problem! the trim in the text processing only can trim "beging and end", but the space character in the middle of the text, please check, and help me solue the problem
 
Text processing>Replace -{-String.Space-} with nothing
 
You can also create a loop and while your string have " " you can replace it for " ".
C# can be your best friend.
 
Код:
Развернуть Свернуть Копировать
string s = project.Variables["yourvar"].Value;
bool clearspace = true;

while (true){
    if (s.Contains("  ")){
        s = s.Reaplce("  "," ");

    }

    else{
       clearspace = false;
    }
}

project.Variables["yourvar"].Value = s.Trim();
 
Код:
Развернуть Свернуть Копировать
string s = project.Variables["yourvar"].Value;
bool clearspace = true;

while (true){
    if (s.Contains("  ")){
        s = s.Reaplce("  "," ");

    }

    else{
       clearspace = false;
    }
}

project.Variables["yourvar"].Value = s.Trim();
thanks, but it was error when run!
 

Вложения

  • 捕获11.JPG
    捕获11.JPG
    33,2 KB · Просмотры: 136

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