Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6073591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:17:15+00:00 2026-05-23T10:17:15+00:00

Below is the input file DELL NOTEBOOK 1000 USD ACER NOTEBOOK HP NOTEBOOK APPLE

  • 0

Below is the input file

     DELL  NOTEBOOK
     1000  USD      
     ACER  NOTEBOOK
     HP    NOTEBOOK
     APPLE MOBILE
     900   USD
     HTC   MOBILE
     800   USD

Basically I need to check if there any word “USD” on the second line and put
the word Yes or No. on the first line.
Expected Output

     DELL  NOTEBOOK   YES
     1000  USD      
     ACER  NOTEBOOK   NO
     HP    NOTEBOOK   NO
     APPLE MOBILE     YES
     900   USD
     HTC   MOBILE     YES
     800   USD

below is my code that need some tweak

      Sub Main()
      Dim fh As StreamReader
      fh = new StreamReader("list.txt")
      dim currency as string
      dim bCurrency as boolean
      Dim s As String = fh.ReadLine()
      While not s Is Nothing
            currency = s.substring(5,3)
            if currency = "USD" then
              bCurrency  = True
            else
                if bCurrency  = true then
                    Console.WriteLine(s & "     Yes")
                    bCurrency  = False
                else
                    Console.WriteLine(s & "     No")
                end if             
            end if

            s = fh.ReadLine
      End While
      fh.Close()
    End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:17:16+00:00Added an answer on May 23, 2026 at 10:17 am

    Edited to include Saving to file and on screen both.

    Do you want the final output to be printed to the screen, or saved into another text file?
    Here is the way it would appear on screen AS WELL AS SAVED to OUTPUT.TXT

     Dim tmpLine as String
     Dim FirstLine as Boolean = True
    
        Dim fh As StreamReader
        Dim fout as StreamWriter
        fh = New StreamReader("list.txt")
        fout = New StreamWriter("output.txt")
    
        Dim line As String = fh.ReadLine()
        Dim lineData As String() = Nothing
    
        While Not line Is Nothing
            lineData = line.Split(" ")
    
           If FirstLine=False Then
                If lineData(1).Equals("USD") Then
                     Console.WriteLine(tmpLine & " Yes")
                     fout.WriteLine(tmpLine & " Yes")
                Else
                     Console.WriteLine(tmpLine & " No") 
                     fout.WriteLine(tmpLine & " No")
                End If
            Else
                 FirstLine = False
            End If
    
            tmpLine = line
            line = fh.ReadLine
        End While
        fh.Close()
    
            If lineData(1).Equals("USD") Then
                 Console.WriteLine(tmpLine & " Yes")
                 fout.WriteLine(tmpLine & " Yes")
            Else
                 Console.WriteLine(tmpLine & " No") 
                 fout.WriteLine(tmpLine & " No")
            End If
        fout.Close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When someone click on Browse for the input file below: <input type=file name=blah />
My input file is as below : HEADER {ABC|*|DEF {GHI 0 1 0} {{Points
Why does the code below not produce an identical output file to the input
For example given an input file like below: sid|storeNo|latitude|longitude 2|1|-28.03õ720000 9|2 10 jgn 352|1|-28.03¿720000
I have a file input as below: -4.0,vijay -2.0,chan -3.0,vijay and my command is
I need to analysis some log file and it look like below, I would
I have an input file like below. element materl(local) ipt-shl stress sig-xx sig-yy sig-zz
I currently use the following code to position a div directly below an input
How can I give the input field below the characteristics listed below? Characteristics: -Text
What is a good way to give the input field below the three characteristics

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.