搜索并替换为字符串 [英] Search and replace in a string

查看:63
本文介绍了搜索并替换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再次祝你好心人!


MS Access 2003,WinXP SP2


这次我遇到了逻辑问题需要在文本框中搜索三个特定字符串之一(度,度和/或度)并将其替换为Chr(176),这是ANSI度符号... I'有一个相当复杂的选择案例,嵌套如果...然后,嵌套做直到...循环结构导致无限循环/崩溃程序。 (我的测试声明是在300度煮30分钟,然后375度煮20分钟,放入250度烤箱保温直到上菜。内部温度不应低于140度才能上菜。我想要它搜索三个单词的多个实例,并用度数符号替换每个单词...)


我会粘贴我正在尝试的内容,希望有人可以毫不费力地发现我的错误...

Hello again good folks!

MS Access 2003, WinXP SP2

This time I''m having a trouble with the logic required to search a text box for one of three particular strings ("degrees", "degree" and/or "deg") and replace it with Chr(176), which is the ANSI degree symbol... I''ve got a rather convoluted select case, nested if... then, nested do until ... loop structure which results in an endless loop/crashed program. (my test statement has been "Cook at 300 deg for 30 minutes, then 375 degrees for 20 minutes, put in 250 degree oven to keep warm until serving. Internal temp should never be below 140 degrees before serving." I want it to search for multiple instances of the three words, and replace each of them with the degree symbol...)

I''ll paste in what I''m trying at the moment, hopefully someone can spot my mistake without too much trouble...

展开 | 选择 | Wrap | 行号

推荐答案

您是否希望数据与度数符号一起存储而不是三个单词中的一个,或者您只是想将其更改为仅用于显示目的?


如果这是我建议使用更新查询的第一个。访问还具有内置的字符串替换功能。加载替换函数上的帮助文件,它应该告诉你需要知道的一切。
Do you want the data to be stored with the degree symbol rather than one of the three words or are you just trying to change this for display purposes only?

If it''s the first I suggest using an update query. Also access has a built in replace function for strings. Load up the help file on the replace function it should tell you everything you need to know.



你想要存储数据吗?使用度数符号而不是三个单词中的一个,或者您只是为了显示目的而仅仅尝试更改它?


如果这是我建议使用更新查询的第一个。访问还具有内置的字符串替换功能。在替换功能上加载帮助文件,它应该告诉您需要知道的一切。
Do you want the data to be stored with the degree symbol rather than one of the three words or are you just trying to change this for display purposes only?

If it''s the first I suggest using an update query. Also access has a built in replace function for strings. Load up the help file on the replace function it should tell you everything you need to know.



我们再见面,Jared ......感谢你们也看到了这个!


我会有看看替换帮助文件,并尝试更新查询的想法,并将回来告诉你它是否适合我。


问候,

Scott

We meet again, Jared... Thanks for looking at this one, too!

I''ll have a look at the replace help file and will try the update query idea, and will be back to let you know if it will work for me or not.

Regards,
Scott



我们再次见面,Jared ......感谢你们看一下这个!


我会看看替换帮助文件,并会尝试更新查询的想法,并会回来让你知道它是否适合我。


问候,

Scott
We meet again, Jared... Thanks for looking at this one, too!

I''ll have a look at the replace help file and will try the update query idea, and will be back to let you know if it will work for me or not.

Regards,
Scott



好​​吧,替换功能似乎正是我想要的,但它不是'我的工作就像我想要的那样!这是我现在的代码:

Well, the Replace function appears to be exactly what I want, however it isn''t working like I want yet! This is the code I have now:

展开 | 选择 | Wrap | 行号


这篇关于搜索并替换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆