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