/*! * @if jp * @brief 与えられた文字列をbool値に変換する * @else * @brief Convert given string into bool value * @endif */ bool toBool(std::string str, std::string yes, std::string no, bool default_value) { std::for_each(str.begin(), str.end(), Toupper()); std::for_each(yes.begin(), yes.end(), Toupper()); std::for_each(no.begin(), no.end(), Toupper()); if (str.find(yes) != std::string::npos) return true; else if (str.find(no) != std::string::npos) return false; else return default_value; }
//------------------------------------------------------------------------------- int32u_t str2int(int8s_t *str, int32u_t radix) { int32u_t result = 0,value; radix = 10; if (*str == '0') { str++; if ((*str == 'x') && isxdigit(str[1])) { radix = 16; str++; } else { radix = 10; } } while ( isxdigit(*str) && (value = isdigit(*str)? *str-'0' : (islower(*str)? Toupper(*str) : *str)-'A'+10) < radix ) { result = result*radix + value; str++; } return result; }
int32_t CFX_ListCtrl::FindNext(int32_t nIndex, FX_WCHAR nChar) const { int32_t nCircleIndex = nIndex; for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) { nCircleIndex++; if (nCircleIndex >= sz) nCircleIndex = 0; if (CFX_ListItem* pListItem = m_aListItems.GetAt(nCircleIndex)) { if (Toupper(pListItem->GetFirstChar()) == Toupper(nChar)) return nCircleIndex; } } return nCircleIndex; }