问题描述
大家好,
我想在数学表达式中替换string + operator + digit的组合。例如,如果我有一个字符串'当前日期是:@ CurrentDate + 2。谢谢',我希望它像这样被替换 - '当前日期是:'2013年8月31日'。谢谢'当前日期是8月29日。任何人都可以帮助我找到实现它的最佳方法吗?谢谢
注:
1.要添加的数字(此处为2)可以是任意数字。
2. @CurrentDate之后可能有空格即:@CurrentDate + 5
3.字符串中可能有多个@CurrentDate,其中包含不同的数字。例如:
'当前日期是:@ CurrentDate + 2。请再次访问@CurrentDate + 11'
Hi All,
I want to replace a combination of string + operator + digit in a mathematical expression. For example, if I have a string 'Hi, The Current Date is: @CurrentDate+2. Thanks', i want it to be replaced like this- 'Hi, The Current Date is: '31 Aug 2013'. Thanks' when current date is 29 Aug. Can anyone help me to find the best approach to accomplish it? Thanks
Note:
1. The digit to add (which is 2 here) can be any number.
2. There could be space after @CurrentDate i.e: @CurrentDate + 5
3. There could be multiple @CurrentDate in the string with different digits. For Example:
'Hi, The Current Date is: @CurrentDate+2. Please visit again on @CurrentDate + 11'
推荐答案
这篇关于SQL中的字符串操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!