Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
utils.cpp
00001 #include "MicroBit.h" 00002 #include "cppNorm.h" 00003 00004 /** 00005 * extend src to lenght with trailChar 00006 * 00007 * @param src to be trailed wih some trailChars 00008 * @param trailChar is the character being added 00009 * @param length of resulting string 00010 * @return string having length length 00011 */ 00012 string trailedWith(const string src, char trailChar, int length) { 00013 if (length <= src.length()) 00014 return src; 00015 char buf[length+1]; 00016 memcpy(buf,src.toCharArray(),src.length()); 00017 memset(buf+src.length(),trailChar, length-src.length()); 00018 buf[length]='\0'; 00019 return string(buf); 00020 }
Generated on Mon Jul 18 2022 21:57:34 by
1.7.2