473,378 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

check for null charecter in a string

how to count the number of charecter in a string without using any inbuilt function in java?
Apr 14 '10 #1
4 2376
jkmyoung
2,057 Expert 2GB
Use a for loop to traverse the string. Are you considering charAt an inbuilt Java function, or are you only referring to length?
Apr 14 '10 #2
@jkmyoung
yes i am considering charAt an inbuilt Java function.
using the charAt and length function can do the program, i want to know can we use array index value for string operation?
Apr 17 '10 #3
pbrockway2
151 Expert 100+
i want to know can we use array index value for string operation?
No, you cannot. A string is a string and has string methods etc, an array is an array and has array methods etc.

It might have been easier just to ask that question.

Why do you not want to use "built in" methods? They are built in so that you can use them. Not using builtin methods leaves you with just using arithmetic and other operators and assigning the results to things but that's about it: a sort of leaf-falling-from-a-tree-in-a-forest-unobserved situation.

As regards the "null" character (do you mean zero?): this has nothing to do with the number of characters in a string in Java. That is, strings are not terminated in any special way.
Apr 18 '10 #4
jkmyoung
2,057 Expert 2GB
If you can't use any inbuilt functions then you can not really use the class. Even the constructor is an inbuilt function. You'll have to build your own String class.
Apr 19 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Durgesh Sharma | last post by:
Hi All, Pleas help me .I am a starter as far as C Language is concerned . How can i Right Trim all the white spaces of a very long (2000 chars) Charecter string ( from the Right Side ) ? or how...
2
by: ad | last post by:
I have a string like string sNo. I want to cast it to int with int.Parse(sNo) but if the string is null or empty, it will thow exception. I must check if sNo is not null and is not empty before...
5
by: B Vidyadhar Joshi | last post by:
I have a function which takes a NOT NULL terminated PWCHAR. int myFunction (PWCHAR pszKey, ULONG ulKeyLen); I have to pass a 4 charecter value to the "key" parameter. For example, "1111". How...
3
by: QT | last post by:
Dear sirs, I try to put limit for text field to stop charecter entery after 2 charecter. But I have no success. Any idea how can I do? Best Regards
4
by: Laphan | last post by:
Hi all In my functions I'm using a double-check all the time to trap if a value has nothing in it and my question is do I need this double-check. My check line is: IF IsNull(xxx) OR...
3
by: ferg | last post by:
I have a Customer table. The table has two different CHECK constraints. Then there is the Customer details dialog, which provides the user with an UI for changing users. I have some UPDATE sql,...
3
by: ayan4u | last post by:
well i need to deal with white spaces in charecter arrays... with static arrays its fine.. char ss; cin.getline(ss, sizeof ss); .... //deals with white spaces
2
by: mail2ravi123 | last post by:
hi all, plz provide me a function that is used to compare wild char and as well as to compare * charecter and \ charecter in the string FYI if we want to compare a string for * charecter then...
4
by: rosh72851 | last post by:
Header file #ifndef STRING_HPP #define STRING_HPP #include <iostream> using namespace std; /* mystring class */
2
by: qwedster | last post by:
Folk! How to programattically check if null value exists in database table (using stored procedure)? I know it's possble in the Query Analyzer (see last SQL query batch statements)? But how...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.