搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Is there a way to unstring a value that i have echoed? I need characters 8 thru 14 of a 17 character field

  • 1 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 cor-el

more options

I am saving a value from a screen called our policy number. The entire policy number is in this format nn-nnn-nnnnnnn-nn. I need characters 8-14 to do a search in another screen. Is there a way that I can unstring this field for only those characters? Or is there a way that I can only save characters 8-14 of the value?

I am saving a value from a screen called our policy number. The entire policy number is in this format nn-nnn-nnnnnnn-nn. I need characters 8-14 to do a search in another screen. Is there a way that I can unstring this field for only those characters? Or is there a way that I can only save characters 8-14 of the value?

所有回覆 (1)

more options

Use a regular expression.

javascript:(function(){var t='nn-nnn-nnnnnnn-nn',p=prompt(t,t);alert(/..-...-(.......)-../.exec(p)?RegExp.$1:'(nothing)');})();