Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Syntax problem with VB.....pls help

  • 06-07-2001 5:11pm
    #1
    Closed Accounts Posts: 2,313 ✭✭✭


    Its a very simple problem, I just dont have the solution smile.gif

    I want to write a string to a file. Generally the string is enclosed in invertad commas --> ""

    The problem is, the string itself contains inverted commas, so when VB sees this it ends the string prematurely. How do I put inverted commas into a string?

    EG.

    write #1, "string goes right "here" but fuks up cause of commas around here"

    Perhaps there is another way around it?

    Ta in advance from a noobie.


Comments

  • Registered Users, Registered Users 2 Posts: 380 ✭✭dogs


    <font face="Verdana, Arial" size="2">Originally posted by Paladin:

    write #1, "string goes right "here" but fuks up cause of commas around here"
    </font>

    write #1, "string goes right \"here\" but fuks up cause of commas around here"


  • Moderators, Social & Fun Moderators Posts: 10,501 Mod ✭✭✭✭ecksor


    Didn't know you could backslash quotes like that in VB. Usually you just doublequote, like "" instead of "


  • Closed Accounts Posts: 6,601 ✭✭✭Kali


    nope you can't backslash in VB, as said the doublequote does the job.


  • Registered Users, Registered Users 2 Posts: 2,660 ✭✭✭Baz_


    I never heard of that doublequoting thing before, I thought you had to use the ascii or something, hmmm...

    very interesting indeed, after a swift search me up, I must concur. I also must take my hat of to you sirs.


  • Closed Accounts Posts: 2,313 ✭✭✭Paladin


    Cheers lads. Turns out ascii values worked for me too.
    I had tried double quotes, but the string ran onto a few more lines and the syntax checker had problems with it :/ but now Ive it sorted.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 380 ✭✭dogs


    Erm, oops, sorry :) been a while since I had to touch VB *shudder*. "" is the best approach, or if you want to go all QBasic'y you can use the ASCII values.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    There is a Chr function in VB. Just us the Ascii value of the character you want to put in. e.g. Chr(13) will but in a carraige return.


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    double quote "Hello ""world""." Of course it's a pain in the backside to read.

    Another option is...

    quote = """"
    print "hello " + quote + "world" + quote + "."

    messy too.


Advertisement