冒号作为分隔符 [英] Colon as a Delimiter

查看:161
本文介绍了冒号作为分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取一个字符串(特别是格式为2008-09-01 00:00的一个字符串)并编写一个if语句来执行一个进程,如果最右边冒号右边的值是什么,但是00


我使用代码从单元格中提取了文本:

I am trying to take a string (specifically one in the format "2008-09-01 00:00") and write an if statement to perform a process if the value to the right of the rightmost colon is anything but "00"

I have extracted the text from the cell using the code:

展开 | 选择 | Wrap | 行号

推荐答案

可以使用拆分。您也可以将InStrRev与Right结合使用。
Split could be used. You could also use InStrRev in conjunction with a Right.


Split()实际上返回一个数组,因此您需要对数组进行Dim然后执行赋值...

Split( ) actually returns an array, so you need to Dim an array and then do the assignment...

展开 | 选择 | Wrap | 行号


如果您只需要使用一次,并且您知道自己想要哪个元素,那么就可以这样做
If you only need to use it once and you know which element you want, you can do this
展开 | 选择 | Wrap | 行号


这篇关于冒号作为分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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