String library.

Dependents:   CheckSum RN41 RealTimeClock TVZ_MU_Seminar ... more

StrLib.h

Committer:
AkinoriHashimoto
Date:
2015-10-09
Revision:
6:4447094b7e51
Parent:
5:9afdff23f890
Child:
7:7bc89a64bfbd

File content as of revision 6:4447094b7e51:

#pragma once

#ifndef MBED_STRLIB_H
#define MBED_STRLIB_H

#include "mbed.h"
#include <string>


/** String(Ascii) -> long(int)
 *
 * @param   string target(str), int Base(8:Oct, 10:Dec, 16:Hex)
 * @return  long int
*/
long   A2I(string, int);

/** int -> string
 *
 * @param   int target(num), int Base(8:Oct, 10:Dec, 16:Hex), int Number of digit
 * @return  string str
*/
string I2A(int num, int base= 10, int digitNum= 0);

/** float -> string
 *
 *  Overload; Output format.
 *  @param float target(num), int Field-width, int Number of decimal-places.
 *  @return string.
*/
string F2A(float num, int fieldWidth, int decimalPlaces, bool fill0= false);
string F2A(float num);

/** string Compare
 *
 * @param   string target, string cmp, int index in target
 * @return  bool
*/
bool strCompare(string trg, string cmp, int idx);   // trg内にcmpが存在する位置がidxか判定。

bool strCompareComplete(string trg, string cmp);

/** Eraze others Alphameric, and convert lower-cases to capitals.
 *
 *  @param  string target, bool to-capitals.
 *  @return string
*/
string toAlpanumeric(string str, bool large=false);

#endif
// EOF