浠ユ妧鏈负涓
substring
js涓璼ubstring鍑芥暟鐨勭敤娉
鍗佷簩 14th
The Javascript substring function is very similar to that of PHP. The first parameter is the start position and the second parameter is the end position. The first character in a javascript string is position 0.
绗竴涓弬鏁版槸寮濮嬩綅缃紝绗簩涓弬鏁版槸缁撴潫浣嶇疆锛屼綅缃槸浠0寮濮嬭鏁扮殑銆
Here is a simple example:
var birthday = ’1978-07-11′
var year = birthday.substring(0,4)
var month = birthday.substring(5,7)
var day = birthday.substring(8,10)
var year = birthday.substring(0,4)
var month = birthday.substring(5,7)
var day = birthday.substring(8,10)
鏈枃鍦板潃锛http://www.yaronspace.cn/blog/index.php/archives/304
struts2涓爣绛剧殑瀛楃涓叉埅鏂敤娉
鍗佷竴 10th
<s:if test=”serviceName.length()>6″>
<s:property value=”serviceName.substring(0,6)” />
</s:if>
<s:else>
<s:property value=”serviceName”/>
</s:else>
杩戞湡璇勮