简体   繁体   English

通过basic4android中的数据库替换文本

[英]replace text via database in basic4android

i wanted to set Label1's text, to Edittext's text, but i wanted to replace some characters though, but the characters were too many and i had to write multiple codes like this : 我想将Label1的文本设置为Edittext的文本,但是我想替换一些字符,但是字符太多了,我不得不编写多个这样的代码:

Label1.text = Edittext.text.Replace("A","B")
Label1.text = Edittext.text.Replace("B","C")
Label1.text = Edittext.text.Replace("D","E")

and so on ... 等等 ...

so i decided put those characters (which i wanted to replace), into a DATABASE , so i built database and a column, which one name's was : Normal , and built a second column, wich one name's was : Replaced , and i wrote the SQL and Cursor and ... codes for loading the database but i have problem, i don't know how to get texts from Normal Column and replace them with Replaced Column , i used this code but it seems it doesn't work : 所以我决定将这些字符(我想替换的字符)放到DATABASE ,于是我建立了数据库和一列,其名称为: Normal ,并建立了第二列,其中一个名称为: Replaced ,然后我写了SQLCursor和...代码,用于加载数据库,但是我有问题,我不知道如何从“ 普通列 ”中获取文本并将其替换为“ 替换列” ,我使用了此代码,但似乎不起作用:

Label1.Text = Edittext1.Text.Replace(Cur1.GetString("Normal"),Cur1.GetString("Replaced"))

i would be very grateful if someone would help me 如果有人能帮助我,我将不胜感激

soryy for bad english 对不好的英语不好

In your code,didn't saved text in EditText1 after editing 在您的代码中,编辑后没有将文本保存在EditText1中

You have to save editing string in variable and use it in all code 您必须将编辑字符串保存在变量中并在所有代码中使用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM