◎正当な理由による書き込みの削除について:      生島英之とみられる方へ:

OpenWatcom C++->画像>1枚


動画、画像抽出 || この掲示板へ 類似スレ 掲示板一覧 人気スレ 動画人気順

このスレへの固定リンク: http://5chb.net/r/tech/1033433728/
ヒント:5chスレのurlに http://xxxx.5chb.net/xxxx のようにbを入れるだけでここでスレ保存、閲覧できます。

ID:DqBt0M+Xのレス一覧:


769デフォルトの名無しさん2014/04/03(木) 04:15:15.90ID:DqBt0M+X
#include <iostream.h>
#include <string.h>
#include <string.hpp>

void display(String & s)
{
    cout << "length = " << s.length() << endl;
    int u = strcspn( s.c_str(), "0123456789"); // Error!
    cout << "u = " << u << endl;
}
// つづく
770デフォルトの名無しさん2014/04/03(木) 04:16:13.95ID:DqBt0M+X
int main(int argc, char *argv[])
{
    const int COUNT = 4096;
    String id("bcd10023");
    int id_length = id.length();

    switch(argc) {
    case 2:
        if(! strcmp(argv[1], "-e") ) { // Errorになるオプション
            String s = id(id_length, COUNT);
            display(s);
        } else {
            display(id);
        }

        break;
    default:
        display(id);
        break;
    }

    return 0;
}
771デフォルトの名無しさん2014/04/03(木) 04:18:00.77ID:DqBt0M+X
C:\work>cspan
length = 8
u = 3

C:\work>cspan -e
length = 0
The instruction at 0x00401412 referenced memory at 0x00000000.
The memory could not be read.

C:\work>cspan -s
length = 8
u = 3
773デフォルトの名無しさん2014/04/03(木) 05:27:06.37ID:DqBt0M+X
部分文字列です
sub-sequenceは、posからはじまって、len個つづきます
The sub-sequence begins at offset pos within the String object and continues for len characters.


String::operator ()()

Synopsis: #include <string.hpp>
public:
String String::operator ()( size_t pos, size_t len ) const;
Semantics: This form of the operator () public member function extracts a sub-sequence of characters from
the String object. A new String object is created that contains the sub-sequence of characters.
The sub-sequence begins at offset pos within the String object and continues for len characters. The
first character of a String object is at position zero.
If pos is greater than or equal to the length of the String object, the result is empty.
If len is such that pos + len exceeds the length of the object, the result is the sub-sequence of characters
from the String object starting at offset pos and running to the end of the String object.
Results: The operator () public member function returns a String object.
See Also: String::operator [], operator char, operator char const *

String Class 873
cpplib.pdf
774デフォルトの名無しさん2014/04/03(木) 05:31:01.56ID:DqBt0M+X
// substri.cpp
#include <iostream.h>
#include <string.hpp>

int main(int argc, char *argv[])
{
    const int COUNT = 4096;
    String id("bcd10023");
    int id_length = id.length();

    String s = id(id_length, COUNT);
    cout << "s: length = " << s.length() << endl;
    cout << s << endl;

    int count = 3;
    int begin = 3;
    String g = id(begin, count);
    cout << "g: length = " << g.length() << endl;
    cout << g << endl;
    return 0;
}
/*

C:\work>substri
s: length = 0

g: length = 3
100

*/

レス:1-200 201-400 401-600 601-800 801-1000 ALL

このスレへの固定リンク: http://5chb.net/r/tech/1033433728/
ヒント:5chスレのurlに http://xxxx.5chb.net/xxxx のようにbを入れるだけでここでスレ保存、閲覧できます。

TOPへ TOPへ  

このエントリをはてなブックマークに追加現在登録者数177 ブックマークへ


全掲示板一覧 この掲示板へ 人気スレ | Youtube 動画 >50 >100 >200 >300 >500 >1000枚 新着画像

 
  ↓この板の人気?スレ↓(一覧)
 
オブジェクト指向はオワコン?
【最速】google guice DI Framework【シンプル】
C/C++の宿題片付けます 170代目
オブジェクトチンポシコシコ隔離病棟
Microsoft .NET MAUI part9 [Xamarin]
安価でプログラミングの教科書を作るスレ
ソケット通信なら俺に任せろ
Kotlin 3
くだすれPython(超初心者用) その36
大学院の研究を使ってサイトを作ったんごwwww
Ruby 初心者スレッド Part 62
くだすれPython(超初心者用) その52【まず1嫁】
MS新フレームワークBlazor、Lighthouseで23点を叩き出すw
Visual Studio 2017 Part7
スレ立てるまでもない確率論の話 1匹目
ふらっと C#,C♯,C#(初心者用) Part146
【悲報】macOSでOpenGL/CLが非推奨、CUDA対応は終了
ぶっちゃけ始めるのにいいフレームワークって何
スレ立てるまでもない質問はここで 163匹目
Firebaseについて語ろう
ふらっと C#,C♯,C#(初心者用) Part136
Google App Engine for java
Visual Studio 2017 Part2
.NET CORE No.2
C++相談室 part162
スレ立てるまでもない質問はここで 147匹目
Subversion r15
ますたーのお勉強中の独り言スレ
Excel VBA 質問スレ Part69
01:50:08 up 7 days, 16:12, 2 users, load average: 264.59, 286.37, 290.64

in 0.16724610328674 sec @[email protected] on 103014