Opened on Feb 29, 2008 at 10:59:42 AM
Closed on Mar 3, 2008 at 8:25:15 PM
#148 closed Bug (Fixed)
_StringProper
| Reported by: | Xenobiologist | Owned by: | Jos |
|---|---|---|---|
| Milestone: | 3.2.11.2 | Component: | Standard UDFs |
| Version: | 3.2.11.1 | Severity: | |
| Keywords: | _StringProper | Cc: |
Description
The func will only work this letters [a-zA-Z]. There are languages which use something like öäü.
Func _StringProper($s_Str) Local $iX = 0 Local $CapNext = 1 Local $s_nStr = "" Local $s_CurChar For $iX = 1 To StringLen($s_Str) $s_CurChar = StringMid($s_Str, $iX, 1) Select Case $CapNext = 1 If StringRegExp($s_CurChar, '[a-zA-Z]') Then $s_CurChar = StringUpper($s_CurChar) $CapNext = 0 EndIf Case Not StringRegExp($s_CurChar, '[a-zA-Z]') $CapNext = 1 Case Else $s_CurChar = StringLower($s_CurChar) EndSelect $s_nStr &= $s_CurChar Next Return ($s_nStr) EndFunc ;==>_StringProper
Mega
Attachments (0)
Change History (8)
comment:1 by , on Feb 29, 2008 at 12:00:31 PM
| Milestone: | 3.2.11.2 |
|---|
comment:2 by , on Feb 29, 2008 at 3:22:12 PM
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
follow-up: 4 comment:3 by , on Feb 29, 2008 at 4:08:35 PM
I think that \b may be useful here for finding word start positions so that the letter can be passed to StringUpper(). Just something to think about for whoever tries to fix this.
comment:4 by , on Mar 1, 2008 at 10:22:08 PM
Replying to Valik:
I think that \b may be useful here for finding word start positions so that the letter can be passed to StringUpper(). Just something to think about for whoever tries to fix this.
Changing the test to this seems to work fine:
StringRegExp($s_CurChar, '[a-zA-ZÀ-ÿ"]')
Does anybody see any issues with that ?
Whole new UDF:
Func _StringProper($s_Str) Local $iX = 0 Local $CapNext = 1 Local $s_nStr = "" Local $s_CurChar For $iX = 1 To StringLen($s_Str) $s_CurChar = StringMid($s_Str, $iX, 1) Select Case $CapNext = 1 If StringRegExp($s_CurChar, '[a-zA-ZÀ-ÿ"]') Then $s_CurChar = StringUpper($s_CurChar) $CapNext = 0 EndIf Case Not StringRegExp($s_CurChar, '[a-zA-ZÀ-ÿ]') $CapNext = 1 Case Else $s_CurChar = StringLower($s_CurChar) EndSelect $s_nStr &= $s_CurChar Next Return ($s_nStr) EndFunc ;==>_StringProper
follow-up: 6 comment:5 by , on Mar 1, 2008 at 10:24:07 PM
See a extra DoubleQuote slipped into the first regex. should be:
If StringRegExp($s_CurChar, '[a-zA-ZÀ-ÿ]') Then
follow-up: 7 comment:6 by , on Mar 2, 2008 at 12:48:56 PM
Replying to Jos:
See a extra DoubleQuote slipped into the first regex. should be:
If StringRegExp($s_CurChar, '[a-zA-ZÀ-ÿ]') Then
only people using šœž or Ÿ will have objections
comment:8 by , on Mar 3, 2008 at 8:25:15 PM
| Milestone: | → 3.2.11.2 |
|---|---|
| Resolution: | → Fixed |
| Status: | assigned → closed |
Fixed in version: 3.2.11.2

Automatic ticket cleanup.