Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Forum Dictionary / Programming / 網頁/網站程式 / JavaScript /

取得部份字串的函式

New Subject
Random
Previous
Next
|
取得部份字串的函式

JavaScript 中的取得部份字串的函式有 substr 和 substring 兩者之間有一點些微的不同:

String.substr(N1,N2) :從指定的位置(N1)向後截取指定長度(N2)的字串。

例:
var a="654321";
alert(a.substr(1,2)) 結果:54

String.substring(N1,N2) :從指定的位置(N1)到指定的位置(N2)的字串。

例:
var a="654321";
alert(a.substring(1,2)) 結果:5

  • Keywords : 位置, substring, substr, 從指定, 字串, alert, String, 654321, 長度, 到指定, 函式, 兩者, 不同, 一點些微, JavaScript
0 0
2010-05-05T12:37:00+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify

Facebook Page

QR-Code and APP Launcher

User Guide
This Webpage

In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
QRCode
  • Auto Platform
    For better browsing experience, it will auto detects your device to display webpage.
  • Bug Report
    Tell us about the idea, problem and errors you found.
  • Comodo Secure
    The sensitive data transmission adopts by SSL-2048 authenticated encryption.
  • Copyright
    © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
  • Revised Version
    V2.2.197
    29 Oct 2024 (GMT+8)