分割字符串并输入到文本区域中

huangapple go评论74阅读模式
英文:

split a string and enter it in textarea

问题

我想拆分字符串"A CV;B003 GR",分隔符是 (;),并希望将该字符串输入网页的文本区域。

字符串的格式应为:
(第一行)A CV
(下一行)B003 GR

因此,以这种方式输入到文本区域中。

英文:

I want to split a string "A CV;B003 GR" and separator is (;)
and wants to enter the string in textarea of a webpage.

Format of the staring should be
(on the first line) A CV
(on the next line) B003 GR

So in this way it should be entered in text area

Please help

答案1

得分: 1

这是一种做法:

String[] text = ("A CV;B003 GR").split(";");
String formattedText = text[0] + "\n" + text[1];
driver.findElement("YOUR_TEXTAREA_LOCATOR").sendKeys(formattedText);
英文:

Here is a way of doing it

String[] text = ("A CV;B003 GR").split(";");
String formattedText = text[0] + "\n" + text[1];
driver.findElement("YOUR_TEXTAREA_LOCATOR").sendKeys(formattedText);

huangapple
  • 本文由 发表于 2020年9月17日 17:48:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/63935461.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定