Skip to content

Commit 439be75

Browse files
committed
StrView toFloat()
1 parent fef569a commit 439be75

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/AudioTools/CoreAudio/AudioBasic/StrView.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,16 @@ class StrView {
599599
return result;
600600
}
601601

602+
/// Converts the string to a float
603+
float toFloat() {
604+
float result = 0;
605+
char* eptr;
606+
if (!isEmpty()) {
607+
result = strtof(chars, &eptr);
608+
}
609+
return result;
610+
}
611+
602612
/// Converts the string to lowercase letters
603613
void toLowerCase() {
604614
if (chars != nullptr) {

0 commit comments

Comments
 (0)