本文整理匯總了C++中Nibbler::getUntilWS方法的典型用法代碼示例。如果您正苦於以下問題:C++ Nibbler::getUntilWS方法的具體用法?C++ Nibbler::getUntilWS怎麽用?C++ Nibbler::getUntilWS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nibbler
的用法示例。
在下文中一共展示了Nibbler::getUntilWS方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main
//.........這裏部分代碼省略.........
n = Nibbler ("one two");
t.ok (n.getUntilRx ("th", s), " 'one two' : getUntilRx ('th') -> true");
t.is (s, "one two", " 'one two' : getUntilRx ('th') -> 'one two'");
n = Nibbler ("one two");
t.ok (n.getUntilRx ("e", s), " 'one two' : getUntilRx ('e') -> true");
t.is (s, "on", " 'one two' : getUntilRx ('e') -> 'on'"); // 30
t.ok (n.getUntilRx ("tw", s), " 'e two' : getUntilRx ('tw') -> true");
t.is (s, "e ", " 'e two' : getUntilRx ('tw') -> 'e '");
t.ok (n.getUntilRx ("$", s), " 'two' : getUntilRx ('$') -> true");
t.is (s, "two", " 'two' : getUntilRx ('$') -> 'two'");
t.ok (n.depleted (), " '' : depleted () -> true");
#endif
// bool getUntilOneOf (const std::string&, std::string&);
t.diag ("Nibbler::getUntilOneOf");
n = Nibbler ("ab.cd");
t.ok (n.getUntilOneOf (".:", s), " 'ab.cd' : getUntilOneOf ('.:') -> true");
t.is (s, "ab", " 'ab.cd' : getUntilOneOf ('.:') -> 'ab'");
t.ok (n.skipN (), " '.cd' : skipN () -> true");
t.ok (n.getUntilOneOf (".:", s), " 'cd' : getUntilOneOf ('.:') -> true");
t.notok (n.getUntilOneOf (".:", s), " '' : getUntilOneOf ('.:') -> false");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool getUntil (const std::string&, std::string&);
t.diag ("Nibbler::getUntil");
n = Nibbler ("ab\r\ncd");
t.ok (n.getUntil ("\r\n", s), "'ab\\r\\ncd' : getUntil ('\\r\\n') -> true");
t.ok (n.skipN (2), " '\\r\\ncd' : skipN (2) -> true");
t.ok (n.getUntil ("\r\n", s), " 'cd' : getUntil ('\\r\\n') -> true");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool getUntilWS (std::string&);
t.diag ("Nibbler::getUntilWS");
n = Nibbler ("ab \t\ncd");
t.ok (n.getUntilWS (s), " 'ab \\t\\ncd' : getUntilWS () -> true");
t.is (s, "ab", " 'ab \\t\\ncd' : getUntilWS () -> 'ab'");
t.ok (n.getUntilWS (s), " ' \\t\\ncd' : getUntilWS () -> true");
t.is (s, "", " ' \\t\\ncd' : getUntilWS () -> ''");
t.ok (n.skipWS (), " 'cd' : skipWS () -> true");
t.ok (n.getUntilWS (s), " '' : getUntilWS () -> true");
t.is (s, "cd", " 'cd' : getUntilWS () -> 'cd'");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipN (const int quantity = 1);
t.diag ("Nibbler::skipN");
n = Nibbler ("abcde");
t.ok (n.skipN (), " 'abcde' : skipN () -> true");
t.ok (n.skipN (2), " 'bcde' : skipN (2 -> true");
t.notok (n.skipN (3), " 'de' : skipN (3 -> false");
t.notok (n.depleted (), " 'de' : depleted () -> true");
// bool skip (char);
t.diag ("Nibbler::skip");
n = Nibbler (" a");
t.ok (n.skip (' '), " ' a' : skip (' ') -> true");
t.ok (n.skip (' '), " ' a' : skip (' ') -> true");
t.notok (n.skip (' '), " 'a' : skip (' ') -> false");
t.notok (n.depleted (), " 'a' : depleted () -> false");
t.ok (n.skip ('a'), " 'a' : skip ('a') -> true");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipAll (char);
t.diag ("Nibbler::skipAll");
n = Nibbler ("aaaabb");
t.ok (n.skipAll ('a'), " 'aaaabb' : skipAll ('a') -> true");