需要的功能 - 字符串部分(来源,部分) [英] Function needed - String Part(Source,Section)

查看:70
本文介绍了需要的功能 - 字符串部分(来源,部分)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的人在这里是我需要帮助的。假设我有一个包含AlphaNumeric数据的文本字段



字段没有设置模式,因此任何给定的字符都可以是alpha或numeric。我需要一个函数来返回

字段内容的请求''部分'。一个''部分''将在文本字段中定义为连续的Alpha或数字

字符。


示例:


字段名称= cFoo


字段值=" 102ab3xz4"

StringPart(cFoo,2)应返回ab (作为字符串)。

StringPart(cFoo,5)应该返回4(作为整数)。


字段值=" a0914zva33"

StringPart(cFoo,1)应该返回a (作为字符串)。

StringPart(cFoo,2)应该返回914。 (整数)。


感谢您提供的任何帮助。


DB

解决方案

字段值=" 102ab3xz4"

StringPart(cFoo,2)应该返回ab (作为字符串)。

答案:中(cfoo,4,2)


StringPart(cFoo,5)应该返回4(作为整数) 。

答案:正确(cfoo,1)


字段值=" a0914zva33"

StringPart(cFoo,1)应该返回a (作为一个字符串)。

答案:左(Cfoo,1)


StringPart(cFoo,2)应该返回914 (作为一个整数)。

答案:中(cfoo,3,3)


希望有所帮助!


你的函数需要查看字符串中的每个字符,保持

跟踪Alpha和Numeric之间的转换次数。当它到达所请求的''部分'时,使用mid函数在转换的开始和结束之间返回

字符串的部分。


" Ima Loozer" < no **** @ EyeDontWantSpam.foowrote in message

news:MP ************************ @ newsgroups .comcast .net ...


好​​的人在这里是我需要帮助的。假设我有一个包含AlphaNumeric数据的文本字段



字段没有设置模式,因此任何给定的字符都可以是alpha或numeric。我需要一个函数来返回

字段内容的请求''部分'。一个''部分''将在文本字段中定义为连续的Alpha或数字

字符。


示例:


字段名称= cFoo


字段值=" 102ab3xz4"

StringPart(cFoo,2)应返回ab (作为字符串)。

StringPart(cFoo,5)应该返回4(作为整数)。


字段值=" a0914zva33"

StringPart(cFoo,1)应该返回a (作为字符串)。

StringPart(cFoo,2)应该返回914。 (整数)。


感谢您提供的任何帮助。


DB



文章< 11 ********************** @ m79g2000cwm.googlegroups .com> ,
jl*******@hotmail.com 说......


Field Value =" 102ab3xz4"

StringPart(cFoo,2)应该返回ab (作为字符串)。

答案:中(cfoo,4,2)


StringPart(cFoo,5)应该返回4(作为整数) 。

答案:正确(cfoo,1)


字段值=" a0914zva33"

StringPart(cFoo,1)应该返回a (作为一个字符串)。

答案:左(Cfoo,1)


StringPart(cFoo,2)应该返回914 (作为一个整数)。

答案:中(cfoo,3,3)


希望有所帮助!



你错过了我所说的100%。我不知道数字和

alphas的变化。我不能硬编码Mid功能。感谢

尝试,但请先阅读输入内容!


OK folks here is what I need help with. Lets assume I have a text field
that will contain AlphaNumeric data. There is no set pattern to the
field such that any given character can be either alpha or numeric. I
need a function that will return the requested ''part'' of the contents of
the field. A ''part'' would be defined as consecutive Alpha or Numeric
characters in the text field.

Examples:

Field Name = cFoo

Field Value = "102ab3xz4"
StringPart(cFoo,2) should return "ab" (as a string).
StringPart(cFoo,5) should return 4 (as an integer).

Field Value = "a0914zva33"
StringPart(cFoo,1) should return "a" (as a string).
StringPart(cFoo,2) should return "914" (as an integer).

Thanks for whatever assistance you can provide.

DB

解决方案

Field Value = "102ab3xz4"
StringPart(cFoo,2) should return "ab" (as a string).
Answer: Mid(cfoo,4,2)

StringPart(cFoo,5) should return 4 (as an integer).
Answer: Right(cfoo,1)

Field Value = "a0914zva33"
StringPart(cFoo,1) should return "a" (as a string).
Answer: Left(Cfoo,1)

StringPart(cFoo,2) should return "914" (as an integer).
Answer: Mid(cfoo,3,3)

Hope that helps!


Your function will need to look at each character in the string, keeping
track of the number of transitions between Alpha and Numeric. When it gets
to the requested ''part'' use the mid function to return the part of the
string between the start and end of the transition.

"Ima Loozer" <no****@EyeDontWantSpam.foowrote in message
news:MP************************@newsgroups.comcast .net...

OK folks here is what I need help with. Lets assume I have a text field
that will contain AlphaNumeric data. There is no set pattern to the
field such that any given character can be either alpha or numeric. I
need a function that will return the requested ''part'' of the contents of
the field. A ''part'' would be defined as consecutive Alpha or Numeric
characters in the text field.

Examples:

Field Name = cFoo

Field Value = "102ab3xz4"
StringPart(cFoo,2) should return "ab" (as a string).
StringPart(cFoo,5) should return 4 (as an integer).

Field Value = "a0914zva33"
StringPart(cFoo,1) should return "a" (as a string).
StringPart(cFoo,2) should return "914" (as an integer).

Thanks for whatever assistance you can provide.

DB



In article <11**********************@m79g2000cwm.googlegroups .com>,
jl*******@hotmail.com says...

Field Value = "102ab3xz4"
StringPart(cFoo,2) should return "ab" (as a string).
Answer: Mid(cfoo,4,2)

StringPart(cFoo,5) should return 4 (as an integer).
Answer: Right(cfoo,1)

Field Value = "a0914zva33"
StringPart(cFoo,1) should return "a" (as a string).
Answer: Left(Cfoo,1)

StringPart(cFoo,2) should return "914" (as an integer).
Answer: Mid(cfoo,3,3)

Hope that helps!

Uh you missed 100% what I said. I will not know where the numerics and
alphas change. I cannot hard code the Mid functions. Thanks for the
try but please read the input first!


这篇关于需要的功能 - 字符串部分(来源,部分)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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