string handling and other problems

i have been working with my current computer program and iam having trouble figureing out how to remove a string part of a string varable name SOjectNames(i). this string contains windows xp or windows 2003 server object names or i shell the command cacls on each folder i get from the dir command that puts it in a file.
Some example code:
Shell("dir/g>>FileName.tos")
open filename using stream reader and get the folders name and pass it to the cacls command:
Shell("Cacls"+ FolderName(i)">>edit>>SObjects.tof")
make streamwriter with name UserObjectNames
UserObjectNames.Readline(SObjectNames(i))
get first object and last two objects out of file beacuse i dont need them they are just repeats of the other objects
While UserObjectNames<>EOF() or OBjectNames(i)<>"" Then
SObjectNames(i)=UserObjectNames.ReadLine()
From The varable on the line above i want to remove the characters after the user and i dont know how.
I also need help on how to use my html help files i create in my vb.net program.
Thanks for any help again, jeffman

Comments

  • Not sure exactly what the string looks like but there are many options. Substring, split if there is a delimiter between data, trim, Left from microsoft.visualbasic, and you can get a much more calcualted result by using regularExpressions. It really depends on what data is in the string which I dont quite get from the description. ON a higher level there might be a better place to get this string... And if you are using it for ACL I htink there are better .Net ways to use then cacls, Is there a reason you are using this ?

    ~rlc



    : i have been working with my current computer program and iam having
    : trouble figureing out how to remove a string part of a string
    : varable name SOjectNames(i). this string contains windows xp or
    : windows 2003 server object names or i shell the command cacls on
    : each folder i get from the dir command that puts it in a file.
    : Some example code:
    : Shell("dir/g>>FileName.tos")
    : open filename using stream reader and get the folders name and pass
    : it to the cacls command:
    : Shell("Cacls"+ FolderName(i)">>edit>>SObjects.tof")
    : make streamwriter with name UserObjectNames
    : UserObjectNames.Readline(SObjectNames(i))
    : get first object and last two objects out of file beacuse i dont
    : need them they are just repeats of the other objects
    : While UserObjectNames<>EOF() or OBjectNames(i)<>"" Then
    : SObjectNames(i)=UserObjectNames.ReadLine()
    : From The varable on the line above i want to remove the characters
    : after the user and i dont know how.
    : I also need help on how to use my html help files i create in my
    : vb.net program.
    : Thanks for any help again, jeffman
  • : Not sure exactly what the string looks like but there are many
    : options. Substring, split if there is a delimiter between data,
    : trim, Left from microsoft.visualbasic, and you can get a much more
    : calcualted result by using regularExpressions. It really depends on
    : what data is in the string which I dont quite get from the
    : description. ON a higher level there might be a better place to get
    : this string... And if you are using it for ACL I htink there are
    : better .Net ways to use then cacls, Is there a reason you are using
    : this ?
    :
    : ~rlc
    :
    :
    :
    : : i have been working with my current computer program and iam having
    : : trouble figureing out how to remove a string part of a string
    : : varable name SOjectNames(i). this string contains windows xp or
    : : windows 2003 server object names or i shell the command cacls on
    : : each folder i get from the dir command that puts it in a file.
    : : Some example code:
    : : Shell("dir/g>>FileName.tos")
    : : open filename using stream reader and get the folders name and pass
    : : it to the cacls command:
    : : Shell("Cacls"+ FolderName(i)">>edit>>SObjects.tof")
    : : make streamwriter with name UserObjectNames
    : : UserObjectNames.Readline(SObjectNames(i))
    : : get first object and last two objects out of file beacuse i dont
    : : need them they are just repeats of the other objects
    : : While UserObjectNames<>EOF() or OBjectNames(i)<>"" Then
    : : SObjectNames(i)=UserObjectNames.ReadLine()
    : : From The varable on the line above i want to remove the characters
    : : after the user and i dont know how.
    : : I also need help on how to use my html help files i create in my
    : : vb.net program.
    the part im wanting to remove is the part of the string where it has semicolons up to the end of the line i read out of the file(example: ":O" or ":permissions here with one letter to show them" .
    : : Thanks for any help again, jeffman
    :
  • seancampbellseancampbell Pennsylvania, USA
    Jeff, I am still confused as to what exactly you are trying to do?

    You have a file that contains Object names in it? And you want to seperate these Objects into there own seperate Strings? I don't know what you are trying to say in your posts...

    Anyways, I wrote up some code to show you some examples of string functions that might help you with what you are trying to do. Note that a lot of the code is commented lines, so when I am saying thinks like Str.IndexOf("a") = something I am actually commenting what the answer to that command would be not trying to set the var.

    [code]
    Dim Str As String
    Str = "Long Hall Way"
    Dim NewStr() As String
    NewStr = Str.Split(" ")
    'NewStr(0) = "Long"
    'NewStr(1) = "Hall"
    'NewStr(2) = "Way"
    Str = "Long-Hall-Way"
    NewStr = Str.Split("-")
    'NewStr(0) = "Long"
    'NewStr(1) = "Hall"
    'NewStr(2) = "Way"

    'Str.IndexOf("Ha") = 5
    'Str.IndexOf("a") = 6
    'Str.IndexOf("a", 7) = 11

    Str = Str.Substring(5, 6)
    'Str now equals "Hall W"

    'Str.ToLower() = "hall w"

    Str = Str.Substring(0, Str.Length - 1)
    'Str now equals "Hall "

    Str = Str.Trim
    'Str now equals "Hall"
    [/code]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories