String library.
Dependents: CheckSum RN41 RealTimeClock TVZ_MU_Seminar ... more
StrLib.h@7:7bc89a64bfbd, 2015-10-20 (annotated)
- Committer:
- AkinoriHashimoto
- Date:
- Tue Oct 20 01:23:22 2015 +0000
- Revision:
- 7:7bc89a64bfbd
- Parent:
- 6:4447094b7e51
support 64bit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AkinoriHashimoto | 0:058192932ad2 | 1 | #pragma once |
AkinoriHashimoto | 0:058192932ad2 | 2 | |
AkinoriHashimoto | 0:058192932ad2 | 3 | #include "mbed.h" |
AkinoriHashimoto | 0:058192932ad2 | 4 | #include <string> |
AkinoriHashimoto | 1:7c89cd414311 | 5 | |
AkinoriHashimoto | 0:058192932ad2 | 6 | |
AkinoriHashimoto | 7:7bc89a64bfbd | 7 | |
AkinoriHashimoto | 7:7bc89a64bfbd | 8 | /** String(Ascii) -> "long long"(64bit) integer. |
AkinoriHashimoto | 3:ad74ab63f78c | 9 | * |
AkinoriHashimoto | 2:14f3ff21096e | 10 | * @param string target(str), int Base(8:Oct, 10:Dec, 16:Hex) |
AkinoriHashimoto | 7:7bc89a64bfbd | 11 | * @return long long int. if -1; error. |
AkinoriHashimoto | 0:058192932ad2 | 12 | */ |
AkinoriHashimoto | 7:7bc89a64bfbd | 13 | long long A2I(string str, unsigned int base); |
AkinoriHashimoto | 0:058192932ad2 | 14 | |
AkinoriHashimoto | 0:058192932ad2 | 15 | /** int -> string |
AkinoriHashimoto | 3:ad74ab63f78c | 16 | * |
AkinoriHashimoto | 2:14f3ff21096e | 17 | * @param int target(num), int Base(8:Oct, 10:Dec, 16:Hex), int Number of digit |
AkinoriHashimoto | 0:058192932ad2 | 18 | * @return string str |
AkinoriHashimoto | 0:058192932ad2 | 19 | */ |
AkinoriHashimoto | 7:7bc89a64bfbd | 20 | string I2A(int num, unsigned int base= 10, unsigned int digitNum= 0); |
AkinoriHashimoto | 7:7bc89a64bfbd | 21 | string I2A(long long num, unsigned int base= 10, unsigned int digitNum= 0); |
AkinoriHashimoto | 0:058192932ad2 | 22 | |
AkinoriHashimoto | 2:14f3ff21096e | 23 | /** float -> string |
AkinoriHashimoto | 3:ad74ab63f78c | 24 | * |
AkinoriHashimoto | 2:14f3ff21096e | 25 | * Overload; Output format. |
AkinoriHashimoto | 2:14f3ff21096e | 26 | * @param float target(num), int Field-width, int Number of decimal-places. |
AkinoriHashimoto | 2:14f3ff21096e | 27 | * @return string. |
AkinoriHashimoto | 2:14f3ff21096e | 28 | */ |
AkinoriHashimoto | 5:9afdff23f890 | 29 | string F2A(float num, int fieldWidth, int decimalPlaces, bool fill0= false); |
AkinoriHashimoto | 2:14f3ff21096e | 30 | string F2A(float num); |
AkinoriHashimoto | 2:14f3ff21096e | 31 | |
AkinoriHashimoto | 0:058192932ad2 | 32 | /** string Compare |
AkinoriHashimoto | 3:ad74ab63f78c | 33 | * |
AkinoriHashimoto | 0:058192932ad2 | 34 | * @param string target, string cmp, int index in target |
AkinoriHashimoto | 0:058192932ad2 | 35 | * @return bool |
AkinoriHashimoto | 0:058192932ad2 | 36 | */ |
AkinoriHashimoto | 0:058192932ad2 | 37 | bool strCompare(string trg, string cmp, int idx); // trg内にcmpが存在する位置がidxか判定。 |
AkinoriHashimoto | 1:7c89cd414311 | 38 | |
AkinoriHashimoto | 4:17e03f0747d9 | 39 | bool strCompareComplete(string trg, string cmp); |
AkinoriHashimoto | 4:17e03f0747d9 | 40 | |
AkinoriHashimoto | 2:14f3ff21096e | 41 | /** Eraze others Alphameric, and convert lower-cases to capitals. |
AkinoriHashimoto | 3:ad74ab63f78c | 42 | * |
AkinoriHashimoto | 2:14f3ff21096e | 43 | * @param string target, bool to-capitals. |
AkinoriHashimoto | 2:14f3ff21096e | 44 | * @return string |
AkinoriHashimoto | 2:14f3ff21096e | 45 | */ |
AkinoriHashimoto | 2:14f3ff21096e | 46 | string toAlpanumeric(string str, bool large=false); |
AkinoriHashimoto | 1:7c89cd414311 | 47 | |
AkinoriHashimoto | 2:14f3ff21096e | 48 | // EOF |