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

  • SEARCH
  • Home
  • 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 8505695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:23:35+00:00 2026-06-11T02:23:35+00:00

I am comparing strings from a text file, but for some reason they never

  • 0

I am comparing strings from a text file, but for some reason they never match. If I do it in ruby it is very easy, but in processing I can not get it to work.
this is the ruby code that works:

f=File.open("priceMap_current_new.txt")

f.each do |str| 
    arrstr=str.split(";")
    if arrstr.length==1
        puts arrstr[0].inspect if arrstr[0]=="next\n"
    end
end

Now here’s the processing version that doesn’t work, actually it doesnt even work without reading from file:

String[] mystr={"number;zero","number;one","number;two","number;three","number;four"};

for(int i=0;i<mystr.length;i++){
  String[] numbers=split(mystr[i],";");
  if(numbers[0]=="number"){
    println("shoooooooooooooooooout");
  }
}

Additionally I would like to ask if there’s a way to inspect elements like in ruby, its very handy, because if I print pts[0] in processing I get “next” when its actually “next\n”
or also how to check datatypes in processing. Thanks!

  • 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-06-11T02:23:36+00:00Added an answer on June 11, 2026 at 2:23 am

    Use if (numbers[0].equals("number"))

    From: Processing doco

    To compare the contents of two Strings, use the equals() method, as in
    “if (a.equals(b))”, instead of “if (a == b)”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to load some text (shader code) from a file that is placed
I have a problem involving encoding/decoding. I read text from file and compare it
I have a simple application that reads data in small strings from large text
I am comparing strings and have to replace umlauts in JS, but it seems
I need to read line by line from text file (log files from server)
Dear all expert i had a problem for comparing my string from document.write with
Possible Duplicate: Comparing Strings in Cocoa Why is this code not recognising the NSString
Possible Duplicate: Python ‘==’ vs ‘is’ comparing strings, ‘is’ fails sometimes, why? In Python,
After a few harsh lessons I now always use OrdinalIgnoreCase when comparing Strings in
Possible Duplicate: Python ‘==’ vs ‘is’ comparing strings, ‘is’ fails sometimes, why? Is a

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.