Răsfoiți Sursa

Prefix with sanitized character if required.

woollybah 9 ani în urmă
părinte
comite
55312017fa
2 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 7 1
      base.stringhelper.bmx
  2. 1 1
      config.bmx

+ 7 - 1
base.stringhelper.bmx

@@ -36,7 +36,7 @@ Type TStringHelper
 	'the string "replaceInvalidCharsWith"
 	'certain characters (German umlauts, French accents) are replaced
 	'with their basic characters (é = e)
-	Function Sanitize:String(value:String, replaceInvalidCharsWith:String="_")
+	Function Sanitize:String(value:String, replaceInvalidCharsWith:String="_", requiresAlphaPrefix:Int = False)
 		Local result:String = ""
 		Local char:String = ""
 
@@ -51,6 +51,12 @@ Type TStringHelper
 
 			'append the char - or the replacement
 			If char <> ""
+				If Not i Then
+					Local n:Int = char[0]
+					If n >= Asc("0") And n <= Asc("9") Then
+						result :+ replaceInvalidCharsWith
+					End If
+				End If
 				result :+ char
 			Else
 				result :+ replaceInvalidCharsWith

+ 1 - 1
config.bmx

@@ -317,7 +317,7 @@ Function BuildHeaderName:String(path:String)
 		path = dir + "_" + file
 	End If
 	
-	Return TStringHelper.Sanitize(path)
+	Return TStringHelper.Sanitize(path, , True)
 End Function
 
 Rem