需要一个简单的逻辑来进行简单的文本操作过程 [英] Need a simple logic for a simple text-manipulation procedure

查看:56
本文介绍了需要一个简单的逻辑来进行简单的文本操作过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想编写一个程序,其中包含一个由空格分隔的字符串

,并在每个空格中放入逗号,但是,最后的

名称应该有"和"在它之前。


让我在一个例子的帮助下解释:


原始字符串是:Toby Grant Michelle Tom程序应该

返回托比,格兰特,米歇尔和汤姆


干杯!

雷克斯
< br>

Hi I want to write a procedure which takes in a string of names
seperated by a whitespace and puts commas at each whitespace the last
name however, should have "and" before it.

Let me explain that with the help of an example:

The original string is: "Toby Grant Michelle Tom" the procedure should
return "Toby, Grant, Michelle and Tom"

Cheers!
Rex

推荐答案

2006年11月20日17:12:57 -0800,Rex < ra ******* @ gmail.comwrote:


实际上,正确的标点符号是:

" Toby,Grant,Michelle,和汤姆

ref:
http://dictionary.reference.com/writ...nctuation.html


使用这些函数的组合:Replace,InStr,Left
On 20 Nov 2006 17:12:57 -0800, "Rex" <ra*******@gmail.comwrote:

Actually, the proper punctuation is:
"Toby, Grant, Michelle, and Tom"
ref:
http://dictionary.reference.com/writ...nctuation.html

Use a combination of these functions: Replace, InStr, Left


,Mid




正确
,
Right


这篇关于需要一个简单的逻辑来进行简单的文本操作过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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