I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
toni01:> InStr() returnerer positionen af det første tegn i den anden streng (dvs. InStr(\"Thomas Daugaard\", \"Daug\") vil returnerer postitionen af D)
terry:> JO! (InStr() > 0) vil evaluere til True hvis den ER større en 0 men True = -1.
Det jeg gerne vil er hvis strengen indeholder er sti lokalt eller på et fælles drev skal den bibeholdes, eller skal man selv tilføje stien til strengen.
tdaugaard I am aware that True = -1 but as I can only get 0, Null, Start or Position as results, and as = and Null will give False then everything else gives True. True?
terry:> To maintain compatability for future development environments it is neccessary to have everything evaluated to either True or False in an If-line as the internal value of True might change in the future and therefore fx. 4 will not evaluate to True but to False instead.
I read an article about people defining True as -1 and False as 0, but that should not be done, instead True IS True and False IS false. It is not recommended to define them as a value.
So, bottom line is that InStr(string, string) is NOT recommended to use as an If-expression, instead use (InStr(string, string) > 0) or = 0.
If Not ((InStr(1, strProjectPath, \":\\\") > 0) Or (InStr(1, strProjectPath, \"\\\\\") > 0)) Then strProjectPath = GetMyDocuments & \"\\\" & strProjectPath End If
The If (InStr(myStr, \":\\\")) statement will always evaluate to either true or false (boolean 0 and -1) no matter what the Instr returns.
And whats the chances of them changing the internal value of true? Its been that way since I start ...
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.