I know...AND51 wrote:Better:Code: Select all
ProcedureReturn Mid(temp.s, 1, Len(temp.s) - 1) ; no, this is too slow ;Better: Right() Procedurereturn Right(temp, Len(temp)-1) ; The best way: PeekS() [unicode-compatible!!!) ProcedureReturn PeekS(@temp+1+#PB_Compiler_Unicode)
6-line procedure to convert to mixed case
-
techjunkie
- Addict

- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
Last edited by techjunkie on Wed Nov 08, 2006 7:13 pm, edited 1 time in total.

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
@techjunkie - doesn't seem to work?
That's using both of your procedures. Cuts off at "jumps".
Code: Select all
Procedure.s CapString(st.s)
For i= 1 To FindString(st.s, " ", 1) + 1
temp.s = temp.s + UCase(Left(StringField(st.s, i, " "), 1)) + LCase(Mid(StringField(st.s, i, " "), 2, Len(StringField(st.s, i, " ")))) + " "
Next
ProcedureReturn Mid(temp.s, 1, Len(temp.s) - 1)
EndProcedure
Procedure.s CapString2(st.s)
For i= 1 To FindString(st.s, " ", 1) + 1
temp.s = temp.s + UCase(Left(StringField(st.s, i, " "), 1)) + LCase(Mid(StringField(st.s, i, " "), 2, Len(StringField(st.s, i, " ")))) + " "
Next
ProcedureReturn temp.s
EndProcedure
string.s = "the QUICK bRoWn fOx jUMPs ovER thE Lazy dog."
Debug CapString(string)
Debug CapString2(string)-
techjunkie
- Addict

- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
I'm running 4.01 as well - from the update tool.
That's what I get. That's weird. I don't have unicode or anything else enabled.
Code: Select all
The Quick Brown Fox Jumps
The Quick Brown Fox Jumps -
techjunkie
- Addict

- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
Hmmm... Same result with that string here too, but this works better...Xombie wrote:I'm running 4.01 as well - from the update tool.
That's what I get. That's weird. I don't have unicode or anything else enabled.Code: Select all
The Quick Brown Fox Jumps The Quick Brown Fox Jumps
Code: Select all
Procedure.s CapString(st.s)
For i = 1 To CountString(st.s, " ") + 1
temp.s = temp.s + UCase(Left(StringField(st.s, i, " "), 1)) + LCase(Mid(StringField(st.s, i, " "), 2, Len(StringField(st.s, i, " ")))) + " "
Next
ProcedureReturn Mid(temp.s, 1, Len(temp.s) - 1)
EndProcedure
Debug CapString("the QUICK bRoWn fOx jUMPs ovER thE Lazy dog.")
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.