LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

substr方法

admin
2010年7月23日 15:48 本文熱度 5861
  basic_string::substr
  basic_string substr(size_type _off = 0,size_type _count = npos) const;
  功能:從一個字符串復制一個從指定位置開始,并具有指定長度的子字符串。
  參數
  _off
  所需的子字符串的起始位置。字符串中第一個字符的索引為 0,默認值為0.
  _count
  復制的字符數目
  返回值
  一個子字符串,從其指定的位置開始
  備注
  如果 length 為 0 或負數,將返回一個空字符串。如果沒有指定該參數,則子字符串將延續到字符串的結尾。
  示例
  下面的示例闡釋了 substr 方法的用法。
  function substrdemo(){
  var s, ss; //declare variables.
  var s = "the rain in spain falls mainly in the plain.";
  ss = s.substr(12, 5); //get substring.
  return(ss); // returns "spain".
  ----------------------------------------------crazyghost_von補充-----------------------------------------------------------------------
  s.substr(12)的結果是 spain falls mainly in the plain.
  ----------------------------------------------------------------------------------------------------------------------------------------------
  code : c++中 的代碼如下
  // basic_string_substr.cpp
  // compile with: /ehsc
  #include <string>
  #include <iostream>
  int main( )
  {
  using namespace std;
  string str1 ("heterological paradoxes are persistent.");
  cout << "the original string str1 is: \n " << str1
  << endl << endl;
  basic_string <char> str2 = str1.substr ( 6 , 7 );
  cout << "the substring str1 copied is: " << str2
  << endl << endl;
  basic_string <char> str3 = str1.substr ( );
  cout << "the default substring str3 is: \n " << str3
  << "\n which is the entire original string." << endl;
  輸出結果:
  the original string str1 is:
  heterological paradoxes are persistent.
  the substring str1 copied is: logical
  the default substring str3 is:
  heterological paradoxes are persistent.
  which is the entire original string.
  }
  在oracle中的用法:
  substr(:new.flagstatus,17,1)
  其中第一一次是是 ( 串,開始,長度)返回子串。

該文章在 2010/7/23 15:48:27 編輯過
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved

黄频国产免费高清视频,久久不卡精品中文字幕一区,激情五月天AV电影在线观看,欧美国产韩国日本一区二区
最新精品国偷自产在线 | 久久久人成影片一区二区三区 | 亚洲福利在线看国产精品 | 日本久久精品视频 | 一区二区三区国产免费AV | 欧美日韩成人一区精品高免费专区 |