473,396 Members | 1,924 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,396 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 2379
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.