Sign in to follow this  
Followers 0
ihousden

StringInStr not working properly?

6 posts in this topic

I have a wierd problem im not sure how to fix.

Im cleaning some array variables and checking the "cleaned" variable against another array to return a line number. I have to clean the first array variables because some have a trailing " *" that I dont need. I can check for and remove the "*", but cleaning the trailing space " " does not seem to be working right. If I remove the space from the array variable, it works fine (as do all the other variables - without edits).

Dim $earch

#region $RSEndpoints
dim $RSEndpoints[5]
$RSEndpoints[0] = "DHCC/ECC/JPPN/MSAC: DHCC 2250 *"
$RSEndpoints[1] = "UBC: LSC 1443"
$RSEndpoints[2] = "UHNBC (Hosp): UHNBC 5030"
$RSEndpoints[3] = "UNBC (Univ): NHSC 9-374"
$RSEndpoints[4] = "UVic: MSB 131"
#endregion
#region $BridgeEndpoints
Dim $BridgeEndpoints[200]
   $BridgeEndpoints[0] = "H.323: ZZ-TCS Joined - Backup" 
   $BridgeEndpoints[1] = "H.323: *TCS Switched"
   $BridgeEndpoints[2] = "H.323: *TCS Switched - Backup"
   $BridgeEndpoints[3] = "H.323: ARC - ARHCC Baker 1"
   $BridgeEndpoints[4] = "H.323: ARC - CGH ICU2"
   $BridgeEndpoints[5] = "H.323: ARC - CRGH 1018" 
   $BridgeEndpoints[6] = "H.323: ARC - CWH 2D22"
   $BridgeEndpoints[7] = "H.323: ARC - DCDH Bsmt" 
   $BridgeEndpoints[8] = "H.323: ARC - Duncan"
   $BridgeEndpoints[9] = "H.323: ARC - FSJH 010" 
   $BridgeEndpoints[10] = "H.323: ARC - KGH CAC 228" 
   $BridgeEndpoints[11] = "H.323: ARC - KGH CAC 237"
   $BridgeEndpoints[12] = "H.323: ARC - LGH Annex 112" 
   $BridgeEndpoints[13] = "H.323: ARC - LGH Seminar C" 
   $BridgeEndpoints[14] = "H.323: ARC - LGH Seminar D" 
   $BridgeEndpoints[15] = "H.323: ARC - MMH - Terrace" 
   $BridgeEndpoints[16] = "H.323: ARC - NRGH 2053" 
   $BridgeEndpoints[17] = "H.323: ARC - NRGH 2060" 
   $BridgeEndpoints[18] = "H.323: ARC - NRGH 2061"
   $BridgeEndpoints[19] = "H.323: ARC - RGH 1763" 
   $BridgeEndpoints[20] = "H.323: ARC - RIH B1"
   $BridgeEndpoints[21] = "H.323: ARC - SJH Comox" 
   $BridgeEndpoints[22] = "H.323: ARC - SMH 1752" 
   $BridgeEndpoints[23] = "H.323: Bell - T1 Audio-bridge" 
   $BridgeEndpoints[24] = "H.323: Bell - T2 Audio Bridge"  
   $BridgeEndpoints[25] = "H.323: IMP - UVIC - Casiro Portable" 
   $BridgeEndpoints[26] = "H.323: IMP - UVIC - Eibner Portable" 
   $BridgeEndpoints[27] = "H.323: IMP - UVIC - Lampron Portable" 
   $BridgeEndpoints[28] = "H.323: IMP - UVIC - MSB 107" 
   $BridgeEndpoints[29] = "H.323: IMP - UVIC - MSB 131" 
   $BridgeEndpoints[30] = "H.323: IMP - UVIC - MSB 150 LT A" 
   $BridgeEndpoints[31] = "H.323: IMP - UVIC - MSB 150 LT B" 
   $BridgeEndpoints[32] = "H.323: IMP - UVIC - MSB 160" 
   $BridgeEndpoints[33] = "H.323: IMP - UVIC - MSB 160B" 
   $BridgeEndpoints[34] = "H.323: IMP - UVIC - MSB 210" 
   $BridgeEndpoints[35] = "H.323: IMP - UVIC - MSB 310 MPL" 
   $BridgeEndpoints[36] = "H.323: IMP - UVIC - MSB 350 GAL" 
   $BridgeEndpoints[37] = "H.323: IMP - UVIC - RJH CA 011" 
   $BridgeEndpoints[38] = "H.323: IMP - UVIC - RJH CA 107-Law Prt" 
   $BridgeEndpoints[39] = "H.323: IMP - UVIC - RJH CA 120" 
   $BridgeEndpoints[40] = "H.323: IMP - UVIC - RJH CA 125" 
   $BridgeEndpoints[41] = "H.323: IMP - UVIC - RJH CA 130" 
   $BridgeEndpoints[42] = "H.323: IMP - UVIC - RM A144" 
   $BridgeEndpoints[43] = "H.323: IMP - UVIC - VGH 1912" 
   $BridgeEndpoints[44] = "H.323: IMP - UVIC - VGH 1914" 
   $BridgeEndpoints[45] = "H.323: IMP - UVIC - VGH 1916" 
   $BridgeEndpoints[46] = "H.323: IMP: VGH Admin Boardroom"  
   $BridgeEndpoints[47] = "H.323: Mirial - Dr. Kuo" 
   $BridgeEndpoints[48] = "H.323: Movi - Anthony Chan" 
   $BridgeEndpoints[49] = "H.323: Movi - Asif Hayat" 
   $BridgeEndpoints[50] = "H.323: Movi - Ferooz Sekandarpoor" 
   $BridgeEndpoints[51] = "H.323: Movi - Izaak Housden" 
   $BridgeEndpoints[52] = "H.323: Movi - Jacky Chan" 
   $BridgeEndpoints[53] = "H.323: Movi - Jaime Fenton" 
   $BridgeEndpoints[54] = "H.323: Movi - Jarret Hill" 
   $BridgeEndpoints[55] = "H.323: Movi - Jason Kennedy" 
   $BridgeEndpoints[56] = "H.323: Movi - Jason Mak" 
   $BridgeEndpoints[57] = "H.323: Movi - Jeremy Murrin" 
   $BridgeEndpoints[58] = "H.323: Movi - Ken Wong" 
   $BridgeEndpoints[59] = "H.323: Movi - Kevin Saltel" 
   $BridgeEndpoints[60] = "H.323: Movi - Matthew Smith" 
   $BridgeEndpoints[61] = "H.323: Movi - Nick Irvine" 
   $BridgeEndpoints[62] = "H.323: Movi - Scott Walker" 
   $BridgeEndpoints[63] = "H.323: Movi - Seena Zhang" 
   $BridgeEndpoints[64] = "H.323: Movi - Terry Wilson" 
   $BridgeEndpoints[65] = "H.323: Movi - Tony Yee" 
   $BridgeEndpoints[66] = "H.323: Movi - Wai Yu" 
   $BridgeEndpoints[67] = "H.323: NMP - UHNBC 5005" 
   $BridgeEndpoints[68] = "H.323: NMP - UHNBC 5011" 
   $BridgeEndpoints[69] = "H.323: NMP - UHNBC 5017" 
   $BridgeEndpoints[70] = "H.323: NMP - UHNBC 5030" 
   $BridgeEndpoints[71] = "H.323: NMP - UHNBC 5031" 
   $BridgeEndpoints[72] = "H.323: NMP - UHNBC Portable" 
   $BridgeEndpoints[73] = "H.323: NMP - UHNBC Portable 2" 
   $BridgeEndpoints[74] = "H.323: NMP - UNBC - NHSC 9-110 GAL" 
   $BridgeEndpoints[75] = "H.323: NMP - UNBC - NHSC 9-200" 
   $BridgeEndpoints[76] = "H.323: NMP - UNBC - NHSC 9-200B" 
   $BridgeEndpoints[77] = "H.323: NMP - UNBC - NHSC 9-235 LT A" 
   $BridgeEndpoints[78] = "H.323: NMP - UNBC - NHSC 9-235 LT B"  
   $BridgeEndpoints[79] = "H.323: NMP - UNBC - NHSC 9-292 MPL" 
   $BridgeEndpoints[80] = "H.323: NMP - UNBC - NHSC 9-370" 
   $BridgeEndpoints[81] = "H.323: NMP - UNBC - NHSC 9-374" 
   $BridgeEndpoints[82] = "H.323: NMP - UNBC - Payne Portable" 
   $BridgeEndpoints[83] = "H.323: NMP - UNBC - Snadden Portable" 
   $BridgeEndpoints[84] = "H.323: SMP - KGH 235 A" 
   $BridgeEndpoints[85] = "H.323: SMP - KGH 235 B" 
   $BridgeEndpoints[86] = "H.323: SMP - KGH LT A" 
   $BridgeEndpoints[87] = "H.323: SMP - KGH LT B" 
   $BridgeEndpoints[88] = "H.323: SMP - UBCO -Jones Portable" 
   $BridgeEndpoints[89] = "H.323: Teresa Marshall E20" 
   $BridgeEndpoints[90] = "H.323: UBCO ART 363" 
   $BridgeEndpoints[91] = "H.323: UBCO FIN 351B" 
   $BridgeEndpoints[92] = "H.323: UBCO FIP 337" 
   $BridgeEndpoints[93] = "H.323: UBCO LIB 307D" 
   $BridgeEndpoints[94] = "H.323: UBCO Research Service Boardroom" 
   $BridgeEndpoints[95] = "H.323: UBCO SSC 102" 
   $BridgeEndpoints[96] = "H.323: VCSD 1700 MXP" 
   $BridgeEndpoints[97] = "H.323: VCSD 3000 MXP" 
   $BridgeEndpoints[98] = "H.323: VCSD AC E20" 
   $BridgeEndpoints[99] = "H.323: VCSD AH E20" 
   $BridgeEndpoints[100] = "H.323: VCSD C60" 
   $BridgeEndpoints[101] = "H.323: VCSD E20" 
   $BridgeEndpoints[102] = "H.323: VFMP - CESEI offsite Codec" 
   $BridgeEndpoints[103] = "H.323: VFMP - CESEI UBC Network" 
   $BridgeEndpoints[104] = "H.323: VFMP - CWH 3D16" 
   $BridgeEndpoints[105] = "H.323: VFMP - DHCC 1020LT" 
   $BridgeEndpoints[106] = "H.323: VFMP - DHCC 11116" 
   $BridgeEndpoints[107] = "H.323: VFMP - DHCC 11124" 
   $BridgeEndpoints[108] = "H.323: VFMP - DHCC 11268" 
   $BridgeEndpoints[109] = "H.323: VFMP - DHCC 11282" 
   $BridgeEndpoints[110] = "H.323: VFMP - DHCC 2201" 
   $BridgeEndpoints[111] = "H.323: VFMP - DHCC 2230" 
   $BridgeEndpoints[112] = "H.323: VFMP - DHCC 2250" 
   $BridgeEndpoints[113] = "H.323: VFMP - DHCC 2252" 
   $BridgeEndpoints[114] = "H.323: VFMP - DHCC 2256" 
   $BridgeEndpoints[115] = "H.323: VFMP - DHCC 2262" 
   $BridgeEndpoints[116] = "H.323: VFMP - DHCC 2263" 
   $BridgeEndpoints[117] = "H.323: VFMP - DHCC 2264" 
   $BridgeEndpoints[118] = "H.323: VFMP - DHCC 2267" 
   $BridgeEndpoints[119] = "H.323: VFMP - DHCC 6150 UR" 
   $BridgeEndpoints[120] = "H.323: VFMP - Eye Care Center" 
   $BridgeEndpoints[121] = "H.323: VFMP - HEC Paetzold Auditorium" 
   $BridgeEndpoints[122] = "H.323: VFMP - JPPN 3414" 
   $BridgeEndpoints[123] = "H.323: VFMP - MSAC 103" 
   $BridgeEndpoints[124] = "H.323: VFMP - MSAC 110" 
   $BridgeEndpoints[125] = "H.323: VFMP - MSAC B08" 
   $BridgeEndpoints[126] = "H.323: VFMP - RCH 017" 
   $BridgeEndpoints[127] = "H.323: VFMP - RCH 025" 
   $BridgeEndpoints[128] = "H.323: VFMP - RCH 074" 
   $BridgeEndpoints[129] = "H.323: VFMP - SPH 1413" 
   $BridgeEndpoints[130] = "H.323: VFMP - SPH 4/5" 
   $BridgeEndpoints[131] = "H.323: VFMP - SPH LT" 
   $BridgeEndpoints[132] = "H.323: VFMP - Taylor Fidler" 
   $BridgeEndpoints[133] = "H.323: VFMP - UBC - GA" 
   $BridgeEndpoints[134] = "H.323: VFMP - UBC - IRC 305" 
   $BridgeEndpoints[135] = "H.323: VFMP - UBC - IRC 324" 
   $BridgeEndpoints[136] = "H.323: VFMP - UBC - IRC B8" 
   $BridgeEndpoints[137] = "H.323: VFMP - UBC - LSC 1443" 
   $BridgeEndpoints[138] = "H.323: VFMP - UBC - LSC 1450a" 
   $BridgeEndpoints[139] = "H.323: VFMP - UBC - LSC CMR" 
   $BridgeEndpoints[140] = "H.323: VFMP - UBC - LSC CTO" 
   $BridgeEndpoints[141] = "H.323: VFMP - UBC - LSC1 LT A" 
   $BridgeEndpoints[142] = "H.323: VFMP - UBC - LSC1 LT B" 
   $BridgeEndpoints[143] = "H.323: VFMP - UBC - LSC2" 
   $BridgeEndpoints[144] = "H.323: VFMP - UBC - LSC2B" 
   $BridgeEndpoints[145] = "H.323: VFMP - UBC - LSC3" 
   $BridgeEndpoints[146] = "H.323: VFMP - UBC - MPL" 
   $BridgeEndpoints[147] = "H.323: VFMP - Vancouver Gen TF" 
   $BridgeEndpoints[148] = "H.323: VIHA IP - NRGH G244" 
   $BridgeEndpoints[149] = "H.323: VIHA IP - NRGH Room 2050" 
   $BridgeEndpoints[150] = "H.323: VIHA IP - RJH HW340" 
   $BridgeEndpoints[151] = "H.323: VIHA IP - WCGH Room 2245" 
   $BridgeEndpoints[152] = "H.323: X - Abbotsford Centre" 
   $BridgeEndpoints[153] = "H.323: X - BCC Fairmont Brdrm" 
   $BridgeEndpoints[154] = "H.323: X - BCCA Rm 1056" 
   $BridgeEndpoints[155] = "H.323: X - BCCA VC Boardroom" 
   $BridgeEndpoints[156] = "H.323: X - BCCA VC Jambor" 
   $BridgeEndpoints[157] = "H.323: X - BCCA VC RO" 
   $BridgeEndpoints[158] = "H.323: X - C&W Intern" 
   $BridgeEndpoints[159] = "H.323: X - CaRms - Ottawa" 
   $BridgeEndpoints[160] = "H.323: X - CrestronHQ" 
   $BridgeEndpoints[161] = "H.323: X - CRH 375" 
   $BridgeEndpoints[162] = "H.323: X - CW Chan Centre" 
   $BridgeEndpoints[163] = "H.323: X - CW D308" 
   $BridgeEndpoints[164] = "H.323: X - Dalhousie" 
   $BridgeEndpoints[165] = "H.323: X - Detwiller 1C13" 
   $BridgeEndpoints[166] = "H.323: X - FHA ARH Cheam 3 Conf" 
   $BridgeEndpoints[167] = "H.323: X - FHA ARH Pharmacy" 
   $BridgeEndpoints[168] = "H.323: X - FHA Barham Brdrm" 
   $BridgeEndpoints[169] = "H.323: X - FHA Bridge" 
   $BridgeEndpoints[170] = "H.323: X - IHA Cranbrook - 3/15" 
   $BridgeEndpoints[171] = "H.323: X - KBH Committee Room" 
   $BridgeEndpoints[172] = "H.323: X - Klink Conference Room"  
   $BridgeEndpoints[173] = "H.323: X - LMH EOC"  
   $BridgeEndpoints[174] = "H.323: X - Penticton Hosp 4thflr Bdrm" 
   $BridgeEndpoints[175] = "H.323: X - RGH CTR" 
   $BridgeEndpoints[176] = "H.323: X - Tandberg Test" 
   $BridgeEndpoints[177] = "H.323: X - U of Calgary" 
   $BridgeEndpoints[178] = "H.323: X - U of Calgary Rm G382" 
   $BridgeEndpoints[179] = "H.323: X - VIHA ABER 3rd Floor" 
   $BridgeEndpoints[180] = "H.323: X - VIHA CRH Mitlenatch Rm"  
   $BridgeEndpoints[181] = "H.323: X - VIHA CRH Texada Rm" 
   $BridgeEndpoints[182] = "H.323: X - VIHA DMHAS Mtg Rm 11" 
   $BridgeEndpoints[183] = "H.323: X - VIHA Duncan CDH Boardroom"
   $BridgeEndpoints[184] = "H.323: X - VIHA EMP MHAS 642" 
   $BridgeEndpoints[185] = "H.323: X - VIHA NRGH 2050A" 
   $BridgeEndpoints[186] = "H.323: X - VIHA NRGH B228" 
   $BridgeEndpoints[187] = "H.323: X - VIHA NRGH G244" 
   $BridgeEndpoints[188] = "H.323: X - VIHA Port Hardy PHH BoardRm" 
   $BridgeEndpoints[189] = "H.323: X - VIHA RJH DT3344" 
   $BridgeEndpoints[190] = "H.323: X - VIHA RJH HW118" 
   $BridgeEndpoints[191] = "H.323: X - VIHA RJH MP Geri" 
   $BridgeEndpoints[192] = "H.323: X - VIHA RJH MP HW340" 
   $BridgeEndpoints[193] = "H.323: X - VIHA RJH Test Unit" 
   $BridgeEndpoints[194] = "H.323: X - VIHA VGH CFAU N203" 
   $BridgeEndpoints[195] = "H.323: X - VIHA VGH CFAU N240" 
   $BridgeEndpoints[196] = "H.323: X - VIHA Vict. Margartita" 
   $BridgeEndpoints[197] = "H.323: X - WCGH, Teleheath Room"
   $BridgeEndpoints[198] = "H.323: X - Whistler Health CC" 
   $BridgeEndpoints[199] = "H.323: ZZ-TCS Joined" 
#endregion Bridge Endpoints Array
#region $newstring (cleaned RSEndpoints)

dim $string = $RSEndpoints[0]
dim $cutpoint = StringInStr($string, ":")
dim $newstring = StringTrimLeft($string,($cutpoint+1)) ; trims string to start one char after the colon ":"
msgbox (0, "newstring", $newstring)
dim $cleanstring = 1
while $cleanstring = 1
    dim $Stringlength = StringLen ($newstring)
    $check = StringInStr($newstring, "*",0,1,($Stringlength - 1), 1)
    if $check > 0 then 
        $newstring = StringTrimRight($newstring, 1)
        $Stringlength = StringLen ($newstring)
    EndIf
    $check = StringInStr($newstring, " ",0,1,($Stringlength - 1), 1)
    if $check > 0 then 
        $newstring = StringTrimRight($newstring, 1)
        $Stringlength = StringLen ($newstring)
    EndIf
    If StringInStr($newstring, "*",0,1,($Stringlength - 1), 1) = 0 and StringInStr($newstring, " ",0,1,($Stringlength - 1), 1) = 0 then $cleanstring = 0
WEnd
msgbox (0, "newstring", $newstring)     

Dim $hit = _IsArrayItemInString ($BridgeEndpoints, $newstring )
MsgBox (0,"array number", $hit)
#endregion


Func _IsArrayItemInString ( $_Array, $_Item )     
    For $_A = 1 To UBound ( $_Array ) - 1         
        If $_Array[$_A] <> '' And StringInStr ( $_Array[$_A], $_Item ) <> 0 Then Return $_A
        Next
    Return False
EndFunc

do I need to query for an ascii space instead of " "? Any help appreciated.

Share this post


Link to post
Share on other sites



You could use a StringRegExpReplace to get exactly what you want and in fact it could be enlarged to make it even easier than what you have it.

BTW

$newstring = StringTrimLeft($string,($cutpoint+1)) ; trims string to start one char after the colon ":" should also include the space ahead of what you want unless of course you want that space there.

This works

$sStr = "DHCC 2250 *"
$sStr = StringRegExpReplace($sStr, "^(.+?)\h?\*?$", "$1")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Oops I hit post reply before I actually added the fix. Here you go,

change the lines

$check = StringInStr($newstring, "*",0,1,($Stringlength - 1), 1)

if $check > 0 then

$newstring = StringTrimRight($newstring, 1)

$Stringlength = StringLen ($newstring)

EndIf

$check = StringInStr($newstring, " ",0,1,($Stringlength - 1), 1)

if $check > 0 then

$newstring = StringTrimRight($newstring, 1)

$Stringlength = StringLen ($newstring)

EndIf

to

If StringRight($newstring,2) = " *" Then $newstring = StringTrimRight($newstring,2)

I have a wierd problem im not sure how to fix.

Im cleaning some array variables and checking the "cleaned" variable against another array to return a line number. I have to clean the first array variables because some have a trailing " *" that I dont need. I can check for and remove the "*", but cleaning the trailing space " " does not seem to be working right. If I remove the space from the array variable, it works fine (as do all the other variables - without edits).

Dim $earch

#region $RSEndpoints
dim $RSEndpoints[5]
$RSEndpoints[0] = "DHCC/ECC/JPPN/MSAC: DHCC 2250 *"
$RSEndpoints[1] = "UBC: LSC 1443"
$RSEndpoints[2] = "UHNBC (Hosp): UHNBC 5030"
$RSEndpoints[3] = "UNBC (Univ): NHSC 9-374"
$RSEndpoints[4] = "UVic: MSB 131"
#endregion
#region $BridgeEndpoints
Dim $BridgeEndpoints[200]
   $BridgeEndpoints[0] = "H.323: ZZ-TCS Joined - Backup" 
   $BridgeEndpoints[1] = "H.323: *TCS Switched"
   $BridgeEndpoints[2] = "H.323: *TCS Switched - Backup"
   $BridgeEndpoints[3] = "H.323: ARC - ARHCC Baker 1"
   $BridgeEndpoints[4] = "H.323: ARC - CGH ICU2"
   $BridgeEndpoints[5] = "H.323: ARC - CRGH 1018" 
   $BridgeEndpoints[6] = "H.323: ARC - CWH 2D22"
   $BridgeEndpoints[7] = "H.323: ARC - DCDH Bsmt" 
   $BridgeEndpoints[8] = "H.323: ARC - Duncan"
   $BridgeEndpoints[9] = "H.323: ARC - FSJH 010" 
   $BridgeEndpoints[10] = "H.323: ARC - KGH CAC 228" 
   $BridgeEndpoints[11] = "H.323: ARC - KGH CAC 237"
   $BridgeEndpoints[12] = "H.323: ARC - LGH Annex 112" 
   $BridgeEndpoints[13] = "H.323: ARC - LGH Seminar C" 
   $BridgeEndpoints[14] = "H.323: ARC - LGH Seminar D" 
   $BridgeEndpoints[15] = "H.323: ARC - MMH - Terrace" 
   $BridgeEndpoints[16] = "H.323: ARC - NRGH 2053" 
   $BridgeEndpoints[17] = "H.323: ARC - NRGH 2060" 
   $BridgeEndpoints[18] = "H.323: ARC - NRGH 2061"
   $BridgeEndpoints[19] = "H.323: ARC - RGH 1763" 
   $BridgeEndpoints[20] = "H.323: ARC - RIH B1"
   $BridgeEndpoints[21] = "H.323: ARC - SJH Comox" 
   $BridgeEndpoints[22] = "H.323: ARC - SMH 1752" 
   $BridgeEndpoints[23] = "H.323: Bell - T1 Audio-bridge" 
   $BridgeEndpoints[24] = "H.323: Bell - T2 Audio Bridge"  
   $BridgeEndpoints[25] = "H.323: IMP - UVIC - Casiro Portable" 
   $BridgeEndpoints[26] = "H.323: IMP - UVIC - Eibner Portable" 
   $BridgeEndpoints[27] = "H.323: IMP - UVIC - Lampron Portable" 
   $BridgeEndpoints[28] = "H.323: IMP - UVIC - MSB 107" 
   $BridgeEndpoints[29] = "H.323: IMP - UVIC - MSB 131" 
   $BridgeEndpoints[30] = "H.323: IMP - UVIC - MSB 150 LT A" 
   $BridgeEndpoints[31] = "H.323: IMP - UVIC - MSB 150 LT B" 
   $BridgeEndpoints[32] = "H.323: IMP - UVIC - MSB 160" 
   $BridgeEndpoints[33] = "H.323: IMP - UVIC - MSB 160B" 
   $BridgeEndpoints[34] = "H.323: IMP - UVIC - MSB 210" 
   $BridgeEndpoints[35] = "H.323: IMP - UVIC - MSB 310 MPL" 
   $BridgeEndpoints[36] = "H.323: IMP - UVIC - MSB 350 GAL" 
   $BridgeEndpoints[37] = "H.323: IMP - UVIC - RJH CA 011" 
   $BridgeEndpoints[38] = "H.323: IMP - UVIC - RJH CA 107-Law Prt" 
   $BridgeEndpoints[39] = "H.323: IMP - UVIC - RJH CA 120" 
   $BridgeEndpoints[40] = "H.323: IMP - UVIC - RJH CA 125" 
   $BridgeEndpoints[41] = "H.323: IMP - UVIC - RJH CA 130" 
   $BridgeEndpoints[42] = "H.323: IMP - UVIC - RM A144" 
   $BridgeEndpoints[43] = "H.323: IMP - UVIC - VGH 1912" 
   $BridgeEndpoints[44] = "H.323: IMP - UVIC - VGH 1914" 
   $BridgeEndpoints[45] = "H.323: IMP - UVIC - VGH 1916" 
   $BridgeEndpoints[46] = "H.323: IMP: VGH Admin Boardroom"  
   $BridgeEndpoints[47] = "H.323: Mirial - Dr. Kuo" 
   $BridgeEndpoints[48] = "H.323: Movi - Anthony Chan" 
   $BridgeEndpoints[49] = "H.323: Movi - Asif Hayat" 
   $BridgeEndpoints[50] = "H.323: Movi - Ferooz Sekandarpoor" 
   $BridgeEndpoints[51] = "H.323: Movi - Izaak Housden" 
   $BridgeEndpoints[52] = "H.323: Movi - Jacky Chan" 
   $BridgeEndpoints[53] = "H.323: Movi - Jaime Fenton" 
   $BridgeEndpoints[54] = "H.323: Movi - Jarret Hill" 
   $BridgeEndpoints[55] = "H.323: Movi - Jason Kennedy" 
   $BridgeEndpoints[56] = "H.323: Movi - Jason Mak" 
   $BridgeEndpoints[57] = "H.323: Movi - Jeremy Murrin" 
   $BridgeEndpoints[58] = "H.323: Movi - Ken Wong" 
   $BridgeEndpoints[59] = "H.323: Movi - Kevin Saltel" 
   $BridgeEndpoints[60] = "H.323: Movi - Matthew Smith" 
   $BridgeEndpoints[61] = "H.323: Movi - Nick Irvine" 
   $BridgeEndpoints[62] = "H.323: Movi - Scott Walker" 
   $BridgeEndpoints[63] = "H.323: Movi - Seena Zhang" 
   $BridgeEndpoints[64] = "H.323: Movi - Terry Wilson" 
   $BridgeEndpoints[65] = "H.323: Movi - Tony Yee" 
   $BridgeEndpoints[66] = "H.323: Movi - Wai Yu" 
   $BridgeEndpoints[67] = "H.323: NMP - UHNBC 5005" 
   $BridgeEndpoints[68] = "H.323: NMP - UHNBC 5011" 
   $BridgeEndpoints[69] = "H.323: NMP - UHNBC 5017" 
   $BridgeEndpoints[70] = "H.323: NMP - UHNBC 5030" 
   $BridgeEndpoints[71] = "H.323: NMP - UHNBC 5031" 
   $BridgeEndpoints[72] = "H.323: NMP - UHNBC Portable" 
   $BridgeEndpoints[73] = "H.323: NMP - UHNBC Portable 2" 
   $BridgeEndpoints[74] = "H.323: NMP - UNBC - NHSC 9-110 GAL" 
   $BridgeEndpoints[75] = "H.323: NMP - UNBC - NHSC 9-200" 
   $BridgeEndpoints[76] = "H.323: NMP - UNBC - NHSC 9-200B" 
   $BridgeEndpoints[77] = "H.323: NMP - UNBC - NHSC 9-235 LT A" 
   $BridgeEndpoints[78] = "H.323: NMP - UNBC - NHSC 9-235 LT B"  
   $BridgeEndpoints[79] = "H.323: NMP - UNBC - NHSC 9-292 MPL" 
   $BridgeEndpoints[80] = "H.323: NMP - UNBC - NHSC 9-370" 
   $BridgeEndpoints[81] = "H.323: NMP - UNBC - NHSC 9-374" 
   $BridgeEndpoints[82] = "H.323: NMP - UNBC - Payne Portable" 
   $BridgeEndpoints[83] = "H.323: NMP - UNBC - Snadden Portable" 
   $BridgeEndpoints[84] = "H.323: SMP - KGH 235 A" 
   $BridgeEndpoints[85] = "H.323: SMP - KGH 235 B" 
   $BridgeEndpoints[86] = "H.323: SMP - KGH LT A" 
   $BridgeEndpoints[87] = "H.323: SMP - KGH LT B" 
   $BridgeEndpoints[88] = "H.323: SMP - UBCO -Jones Portable" 
   $BridgeEndpoints[89] = "H.323: Teresa Marshall E20" 
   $BridgeEndpoints[90] = "H.323: UBCO ART 363" 
   $BridgeEndpoints[91] = "H.323: UBCO FIN 351B" 
   $BridgeEndpoints[92] = "H.323: UBCO FIP 337" 
   $BridgeEndpoints[93] = "H.323: UBCO LIB 307D" 
   $BridgeEndpoints[94] = "H.323: UBCO Research Service Boardroom" 
   $BridgeEndpoints[95] = "H.323: UBCO SSC 102" 
   $BridgeEndpoints[96] = "H.323: VCSD 1700 MXP" 
   $BridgeEndpoints[97] = "H.323: VCSD 3000 MXP" 
   $BridgeEndpoints[98] = "H.323: VCSD AC E20" 
   $BridgeEndpoints[99] = "H.323: VCSD AH E20" 
   $BridgeEndpoints[100] = "H.323: VCSD C60" 
   $BridgeEndpoints[101] = "H.323: VCSD E20" 
   $BridgeEndpoints[102] = "H.323: VFMP - CESEI offsite Codec" 
   $BridgeEndpoints[103] = "H.323: VFMP - CESEI UBC Network" 
   $BridgeEndpoints[104] = "H.323: VFMP - CWH 3D16" 
   $BridgeEndpoints[105] = "H.323: VFMP - DHCC 1020LT" 
   $BridgeEndpoints[106] = "H.323: VFMP - DHCC 11116" 
   $BridgeEndpoints[107] = "H.323: VFMP - DHCC 11124" 
   $BridgeEndpoints[108] = "H.323: VFMP - DHCC 11268" 
   $BridgeEndpoints[109] = "H.323: VFMP - DHCC 11282" 
   $BridgeEndpoints[110] = "H.323: VFMP - DHCC 2201" 
   $BridgeEndpoints[111] = "H.323: VFMP - DHCC 2230" 
   $BridgeEndpoints[112] = "H.323: VFMP - DHCC 2250" 
   $BridgeEndpoints[113] = "H.323: VFMP - DHCC 2252" 
   $BridgeEndpoints[114] = "H.323: VFMP - DHCC 2256" 
   $BridgeEndpoints[115] = "H.323: VFMP - DHCC 2262" 
   $BridgeEndpoints[116] = "H.323: VFMP - DHCC 2263" 
   $BridgeEndpoints[117] = "H.323: VFMP - DHCC 2264" 
   $BridgeEndpoints[118] = "H.323: VFMP - DHCC 2267" 
   $BridgeEndpoints[119] = "H.323: VFMP - DHCC 6150 UR" 
   $BridgeEndpoints[120] = "H.323: VFMP - Eye Care Center" 
   $BridgeEndpoints[121] = "H.323: VFMP - HEC Paetzold Auditorium" 
   $BridgeEndpoints[122] = "H.323: VFMP - JPPN 3414" 
   $BridgeEndpoints[123] = "H.323: VFMP - MSAC 103" 
   $BridgeEndpoints[124] = "H.323: VFMP - MSAC 110" 
   $BridgeEndpoints[125] = "H.323: VFMP - MSAC B08" 
   $BridgeEndpoints[126] = "H.323: VFMP - RCH 017" 
   $BridgeEndpoints[127] = "H.323: VFMP - RCH 025" 
   $BridgeEndpoints[128] = "H.323: VFMP - RCH 074" 
   $BridgeEndpoints[129] = "H.323: VFMP - SPH 1413" 
   $BridgeEndpoints[130] = "H.323: VFMP - SPH 4/5" 
   $BridgeEndpoints[131] = "H.323: VFMP - SPH LT" 
   $BridgeEndpoints[132] = "H.323: VFMP - Taylor Fidler" 
   $BridgeEndpoints[133] = "H.323: VFMP - UBC - GA" 
   $BridgeEndpoints[134] = "H.323: VFMP - UBC - IRC 305" 
   $BridgeEndpoints[135] = "H.323: VFMP - UBC - IRC 324" 
   $BridgeEndpoints[136] = "H.323: VFMP - UBC - IRC B8" 
   $BridgeEndpoints[137] = "H.323: VFMP - UBC - LSC 1443" 
   $BridgeEndpoints[138] = "H.323: VFMP - UBC - LSC 1450a" 
   $BridgeEndpoints[139] = "H.323: VFMP - UBC - LSC CMR" 
   $BridgeEndpoints[140] = "H.323: VFMP - UBC - LSC CTO" 
   $BridgeEndpoints[141] = "H.323: VFMP - UBC - LSC1 LT A" 
   $BridgeEndpoints[142] = "H.323: VFMP - UBC - LSC1 LT B" 
   $BridgeEndpoints[143] = "H.323: VFMP - UBC - LSC2" 
   $BridgeEndpoints[144] = "H.323: VFMP - UBC - LSC2B" 
   $BridgeEndpoints[145] = "H.323: VFMP - UBC - LSC3" 
   $BridgeEndpoints[146] = "H.323: VFMP - UBC - MPL" 
   $BridgeEndpoints[147] = "H.323: VFMP - Vancouver Gen TF" 
   $BridgeEndpoints[148] = "H.323: VIHA IP - NRGH G244" 
   $BridgeEndpoints[149] = "H.323: VIHA IP - NRGH Room 2050" 
   $BridgeEndpoints[150] = "H.323: VIHA IP - RJH HW340" 
   $BridgeEndpoints[151] = "H.323: VIHA IP - WCGH Room 2245" 
   $BridgeEndpoints[152] = "H.323: X - Abbotsford Centre" 
   $BridgeEndpoints[153] = "H.323: X - BCC Fairmont Brdrm" 
   $BridgeEndpoints[154] = "H.323: X - BCCA Rm 1056" 
   $BridgeEndpoints[155] = "H.323: X - BCCA VC Boardroom" 
   $BridgeEndpoints[156] = "H.323: X - BCCA VC Jambor" 
   $BridgeEndpoints[157] = "H.323: X - BCCA VC RO" 
   $BridgeEndpoints[158] = "H.323: X - C&W Intern" 
   $BridgeEndpoints[159] = "H.323: X - CaRms - Ottawa" 
   $BridgeEndpoints[160] = "H.323: X - CrestronHQ" 
   $BridgeEndpoints[161] = "H.323: X - CRH 375" 
   $BridgeEndpoints[162] = "H.323: X - CW Chan Centre" 
   $BridgeEndpoints[163] = "H.323: X - CW D308" 
   $BridgeEndpoints[164] = "H.323: X - Dalhousie" 
   $BridgeEndpoints[165] = "H.323: X - Detwiller 1C13" 
   $BridgeEndpoints[166] = "H.323: X - FHA ARH Cheam 3 Conf" 
   $BridgeEndpoints[167] = "H.323: X - FHA ARH Pharmacy" 
   $BridgeEndpoints[168] = "H.323: X - FHA Barham Brdrm" 
   $BridgeEndpoints[169] = "H.323: X - FHA Bridge" 
   $BridgeEndpoints[170] = "H.323: X - IHA Cranbrook - 3/15" 
   $BridgeEndpoints[171] = "H.323: X - KBH Committee Room" 
   $BridgeEndpoints[172] = "H.323: X - Klink Conference Room"  
   $BridgeEndpoints[173] = "H.323: X - LMH EOC"  
   $BridgeEndpoints[174] = "H.323: X - Penticton Hosp 4thflr Bdrm" 
   $BridgeEndpoints[175] = "H.323: X - RGH CTR" 
   $BridgeEndpoints[176] = "H.323: X - Tandberg Test" 
   $BridgeEndpoints[177] = "H.323: X - U of Calgary" 
   $BridgeEndpoints[178] = "H.323: X - U of Calgary Rm G382" 
   $BridgeEndpoints[179] = "H.323: X - VIHA ABER 3rd Floor" 
   $BridgeEndpoints[180] = "H.323: X - VIHA CRH Mitlenatch Rm"  
   $BridgeEndpoints[181] = "H.323: X - VIHA CRH Texada Rm" 
   $BridgeEndpoints[182] = "H.323: X - VIHA DMHAS Mtg Rm 11" 
   $BridgeEndpoints[183] = "H.323: X - VIHA Duncan CDH Boardroom"
   $BridgeEndpoints[184] = "H.323: X - VIHA EMP MHAS 642" 
   $BridgeEndpoints[185] = "H.323: X - VIHA NRGH 2050A" 
   $BridgeEndpoints[186] = "H.323: X - VIHA NRGH B228" 
   $BridgeEndpoints[187] = "H.323: X - VIHA NRGH G244" 
   $BridgeEndpoints[188] = "H.323: X - VIHA Port Hardy PHH BoardRm" 
   $BridgeEndpoints[189] = "H.323: X - VIHA RJH DT3344" 
   $BridgeEndpoints[190] = "H.323: X - VIHA RJH HW118" 
   $BridgeEndpoints[191] = "H.323: X - VIHA RJH MP Geri" 
   $BridgeEndpoints[192] = "H.323: X - VIHA RJH MP HW340" 
   $BridgeEndpoints[193] = "H.323: X - VIHA RJH Test Unit" 
   $BridgeEndpoints[194] = "H.323: X - VIHA VGH CFAU N203" 
   $BridgeEndpoints[195] = "H.323: X - VIHA VGH CFAU N240" 
   $BridgeEndpoints[196] = "H.323: X - VIHA Vict. Margartita" 
   $BridgeEndpoints[197] = "H.323: X - WCGH, Teleheath Room"
   $BridgeEndpoints[198] = "H.323: X - Whistler Health CC" 
   $BridgeEndpoints[199] = "H.323: ZZ-TCS Joined" 
#endregion Bridge Endpoints Array
#region $newstring (cleaned RSEndpoints)

dim $string = $RSEndpoints[0]
dim $cutpoint = StringInStr($string, ":")
dim $newstring = StringTrimLeft($string,($cutpoint+1)) ; trims string to start one char after the colon ":"
msgbox (0, "newstring", $newstring)
dim $cleanstring = 1
while $cleanstring = 1
    dim $Stringlength = StringLen ($newstring)
    $check = StringInStr($newstring, "*",0,1,($Stringlength - 1), 1)
    if $check > 0 then 
        $newstring = StringTrimRight($newstring, 1)
        $Stringlength = StringLen ($newstring)
    EndIf
    $check = StringInStr($newstring, " ",0,1,($Stringlength - 1), 1)
    if $check > 0 then 
        $newstring = StringTrimRight($newstring, 1)
        $Stringlength = StringLen ($newstring)
    EndIf
    If StringInStr($newstring, "*",0,1,($Stringlength - 1), 1) = 0 and StringInStr($newstring, " ",0,1,($Stringlength - 1), 1) = 0 then $cleanstring = 0
WEnd
msgbox (0, "newstring", $newstring)     

Dim $hit = _IsArrayItemInString ($BridgeEndpoints, $newstring )
MsgBox (0,"array number", $hit)
#endregion


Func _IsArrayItemInString ( $_Array, $_Item )     
    For $_A = 1 To UBound ( $_Array ) - 1         
        If $_Array[$_A] <> '' And StringInStr ( $_Array[$_A], $_Item ) <> 0 Then Return $_A
        Next
    Return False
EndFunc

do I need to query for an ascii space instead of " "? Any help appreciated.

Edited by Quual

Share this post


Link to post
Share on other sites

Thanks Quual. Your code is so tight, I love it (im getting better but it sure takes practice). I thought of putting the space and star together, but the initial array is a small static sample of a much larger array that I have yet to build. I cant be certain at this point that all entries meet that " *" criteria.

Ill use it until I find an exception, but may still have to figure out how to remove a trailing space later.

Thanks very much for the code cleanup! thats great!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Any trailing space can be trimmed with StringStripWS($sStr, 2) so you could add that in anyway. If there is no trailing space then nothing will happen.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Any trailing space can be trimmed with StringStripWS($sStr, 2) so you could add that in anyway. If there is no trailing space then nothing will happen.

Thanks GEOSoft!.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0