Skip to content

Commit e04cd64

Browse files
committed
Str corrections
1 parent b3605cf commit e04cd64

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/AudioBasic/Str.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Str {
114114
this->maxlen = maxlen;
115115
this->len = len;
116116
this->is_const = isConst;
117-
if (len==0){
117+
if (len==0 && !isConst){
118118
this->chars[0] = 0;
119119
}
120120
}
@@ -610,6 +610,15 @@ class Str {
610610
return result;
611611
}
612612

613+
/// Converts the string to an long
614+
long toLong() {
615+
long result = 0;
616+
if (!isEmpty()){
617+
result = atol(chars);
618+
}
619+
return result;
620+
}
621+
613622
/// Converts the string to lowercase letters
614623
void toLowerCase(){
615624
if (chars!=nullptr){

0 commit comments

Comments
 (0)