Akinori Hashimoto / StrLib

Dependents:   CheckSum RN41 RealTimeClock TVZ_MU_Seminar ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StrLib.h Source File

StrLib.h

00001 #pragma once
00002 
00003 #include "mbed.h"
00004 #include <string>
00005 
00006 
00007 
00008 /** String(Ascii) -> "long long"(64bit) integer.
00009  *
00010  * @param   string target(str), int Base(8:Oct, 10:Dec, 16:Hex)
00011  * @return  long long int. if -1; error.
00012 */
00013 long long A2I(string str, unsigned int base);
00014 
00015 /** int -> string
00016  *
00017  * @param   int target(num), int Base(8:Oct, 10:Dec, 16:Hex), int Number of digit
00018  * @return  string str
00019 */
00020 string I2A(int num, unsigned int base= 10, unsigned int digitNum= 0);
00021 string I2A(long long num, unsigned int base= 10, unsigned int digitNum= 0);
00022 
00023 /** float -> string
00024  *
00025  *  Overload; Output format.
00026  *  @param float target(num), int Field-width, int Number of decimal-places.
00027  *  @return string.
00028 */
00029 string F2A(float num, int fieldWidth, int decimalPlaces, bool fill0= false);
00030 string F2A(float num);
00031 
00032 /** string Compare
00033  *
00034  * @param   string target, string cmp, int index in target
00035  * @return  bool
00036 */
00037 bool strCompare(string trg, string cmp, int idx);   // trg内にcmpが存在する位置がidxか判定。
00038 
00039 bool strCompareComplete(string trg, string cmp);
00040 
00041 /** Eraze others Alphameric, and convert lower-cases to capitals.
00042  *
00043  *  @param  string target, bool to-capitals.
00044  *  @return string
00045 */
00046 string toAlpanumeric(string str, bool large=false);
00047 
00048 // EOF