在字段中查找特定字符并将其替换为短语 [英] Find a Specific Character in a Field and Replace it with a Phrase

查看:25
本文介绍了在字段中查找特定字符并将其替换为短语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个小时以来,我一直在互联网上搜索这个问题的答案,但我什么也没找到.我对 FoxPro 的经验非常有限.这可能是两个问题合二为一.

I've been searching around the internet for an answer to this question for a few hours and I'm not able to find anything. My experience with FoxPro is quite limited. This will probably be 2 questions in one.

第一个问题:我有一个项目列表,其中一些项目可能包含逗号,这在我将数据传输到的程序中是不允许的.

First question: I have a list of items and some of these items may contain a comma which is not allowed in the program I'm transferring the data to.

我基本上需要这样的声明:

I basically need sort of a statement like this:

REPLACE ALL Field1 with STRTRAN(field1, "," , "<break time='250ms' />"

这样的事情能完成我所需要的吗?

Is something like that going to accomplish what I need?

第二个问题:我有 5 个单独的字段,我需要将其中的数据移动到新字段中.像这样的东西.

Second Question: I have 5 separate fields that I need the data from to be moved into a new field. Something like this.

字段 1:十月场 2:21领域 3:2013场 4:5:00字段 5:下午

Field1: October Field2: 21 Field3: 2013 Field4: 5:00 Field5: PM

FinalField 感谢您的电子邮件,您的约会安排在 [Field1] [Field2] [Field3] [Field4] [Field5].

FinalField Thank you for your email, your appointment is scheduled for [Field1] [Field2] [Field3] at [Field4] [Field5].

这将用于数千条记录,因此我想制定一个语句来一次性替换它们.

This will be for thousands of records, so I'd like to formulate a statement that would replace them all at once.

REPLACE ALL FinalField with STRTRAN(

在那之后,我不确定括号内需要什么格式才能用我需要的字段正确替换该字段.提前感谢您的帮助.

After that I'm not sure what format it needs to be within the parenthesis to properly replace the field with what I need. Thank you for your help in advance.

推荐答案

第一个问题:您所写的内容会将每次出现的逗号替换为<break time='250ms'/>".不确定这就是你所追求的.简单地删除所有逗号:

First question: What you've written will replace each occurrence of a comma with "<break time='250ms' />". Not sure that's what you're after. To simply remove all commas:

REPLACE ALL field1 WITH STRTRAN(field1, [,], [])

REPLACE ALL field1 WITH STRTRAN(field1, [,], [])

会做的.在处理逗号、引号等时,我喜欢使用 [ ] 字符作为字符串分隔符 - 为清楚起见.

will do it. I like to use the [ ] characters as string delimiters when I'm dealing with commas, quotation marks, etc. - for clarity.

查看 TEXTMERGE() 函数以回答您的第二个问题.

Take a look at the TEXTMERGE() function for the answer to your second question.

这篇关于在字段中查找特定字符并将其替换为短语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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