나는이 질문은 이미 허용 대답을 가지고 볼 수 있지만, 나는 당신이 단어를 '위대한'는 문자열입니다 찾아 그것을 할 수있는 또 다른 답 :
를 추가 할 거라고 생각했다. 현대 CFML하면과 같이 그것을 할 수 있습니다 :
<cfscript>
myVar = "One of the myths associated with the Great Wall of China is that it is the only man-made structure";
// where is the word 'Great'?
a = myVar.FindNoCase("Great");
substring = myVar.removeChars(1, a-1);
writeDump(substring);
</cfscript>
당신이 양쪽 오프 문자를 차단하려는 경우 중간 당신에게 좀 더 유연성을 제공 할 사용. 로 기록 될 것이다 CF의 이전 버전에서
<cfscript>
myVar = "One of the myths associated with the Great Wall of China is that it is the only man-made structure";
// where is the word 'Great'?
a = myVar.FindNoCase("Great");
// get the substring
substring = myVar.mid(a, myVar.len());
writeDump(substring);
</cfscript>
:
<cfscript>
myVar = "One of the myths associated with the Great Wall of China is that it is the only man-made structure";
// where is the word 'Great'
a = FindNoCase("Great", myVar);
// get the substring
substring = mid(myVar, a, len(myVar));
writeDump(substring);
</cfscript>
, 당신이 더 적절한 결정해야 할 것이다 또한 같은 결과를 달성하기 위해 정규 표현식을 사용할 수
당신의 사용 사례 :
<cfscript>
myVar = "One of the myths associated with the Great Wall of China is that it is the only man-made structure";
// strip all chars before 'Great'
substring = myVar.reReplaceNoCase(".+(Great)", "\1");
writeDump(substring);
</cfscript>