How to calculate byte size of a string

Hi forum;
Can you tell me how can I calculate byte count of a string.

Tahir wrote:
I read somewhere that string 0123456789ABCDEFFEDCBA987654321089ABCDEF01234567 is 192 bit. Where as it is 48 Byte (one char = 1 byte) or 384 Bits. But 192*2=384. So whats this math? Any pointer?It depends what you mean by "byte count", because it's likely to depend on the character encoding you choose, but the definitive answer is probably to use getBytes(). For example:
String s = "0123456789ABCDEFFEDCBA987654321089ABCDEF01234567";
System.out.println(s.getBytes("utf8").length);displays 48, but
System.out.println(s.getBytes("unicode").length);displays 98.
Not quite sure why the extra 2 bytes, but I'm sure someone else will know.
Winston

Similar Messages

  • How can I manage byte size of a string value in java?

    Hi,
    How can I manage byte size of a string value in java? I have NAME column in my database table, of type VARCHAR2(128). Supports multilingual, so value in Name can be English, French or Dutch.. like that. Byte size of English character is 1 and that of French is 2 and varies.. . Because of this reason I find difficulty in insert query. Please suggest solution.

    But the event does not really have a size - you can export the photos and make the size pretty much what you want - while it is in iPhoto it is an event
    I guess that iPhoto could report the size of the original photos as imported - or the size of the modified photos if exported as JPEGs - or the size of the modified photos if exported with a maximum dimension of 1080 - but the event simply is photos and does not have a "size" until you export it
    Obviously you want to know the size but the question was
    what is your puprose for knowing the size?
    WIth that information maybe there is a way to get you what you want
    But the basic answer is simply that an event does not have a size - an event is a collection of photos and each photo has either two or three versions in the iPhoto library and each photo can be exported for outside use in several formats and at any size
    LN

  • How to calculate table size given the structure.

    Today i was asked how to estimate the size of the table given th transactions,.
    table has 90 column all varchar(10)
    How to calculate the size of table which has no data.
    Message was edited by:
    Maran.E

    hi,
    SQL> create table test as select * from all_objects ;
    Table created.
    SQL> create table test1 as select * from all_objects where 1 = 2 ;
    Table created.
    sql>select segment_name,bytes/1024/1024 "size", blocks
    from dba_segments
    where segment_name in ('TEST','TEST1')
    SEGMENT_NAME
          size     BLOCKS
    TEST1
         .0625          8
    TEST
             6        768regards
    Taj

  • How to calculate the size of web forms in hyperion planning?

    Hi Experts,
    I am trying to calculate the size of planning forms in Hyperion smart view., but i am unable to find out the way to calculate.
    Can you pls explain how to calculate the size of web form in Smart view?
    --- Srini.

    Hi Srini,
    First, here is what Oracle says:
    Data Form Size Estimation:
    To get a rough estimate of data form size, open the data form and select File > Save As from the browser. The size of the .HTML file is the portion of the data form that changes based on grid size. The .JS files remain the same size and can be cached, depending on browser settings. Information such as data form definitions, pages, and .gif files are not compressed when data forms are opened and sent to the Web browser.
    I have not been able to find out using their method.
    In any case, you can find out the size of grid by using below
    1. Right click on the form grid and click "View source"
    2. Save the source file as "Example.html"
    3. Right click the saved file and click "Properties"
    4. The Form size whould be same as that of file..
    Let me know if it helps.
    Cheers
    RS

  • How to measure the size of a string

    windows app store how to measure the size of a string?
    string str = "Hello word windows app store";

    if you need the actual width the string occupies in pixels than use (see
    this MSDN link for more details):
    Graphics.MeasureString(String, Font)
    if you only need the "length" of the string i.e. no. of characters than use (see
    this MSDN link for more details):
    str.Length
    dont forget to bing / google :)
    hope this helps!
    Graphics.MeasureString(String, Font) can not use in windows store app.
    TextBlock has Measure()
    method, as following:
    Size MeasureString(string content, Size availableSize, double fontSize, string fontFamily="Segoe UI")
        TextBlock tb = new TextBlock();
        tb.TextWrapping = TextWrapping.Wrap;
        tb.Text = content;
        tb.FontFamily = new Windows.UI.Xaml.Media.FontFamily(fontFamily);
        tb.FontSize = fontSize;
        tb.Measure(availableSize);
        return tb.DesiredSize;
    Test:
    string str = "Hello word windows app store";
    Size size = MeasureString(str, new Size(800, 600), 40);

  • How to calculate the length of a string

    Hi everyone,
    A simple question. How to calculate the length of a string?
    Thanks!

    Hi Wuyia Nata,
      As everyone has suggested you search the forum before posting a question, i guess for basic questions u never have to post a question, you will get the answer in your search. Anyways see the code below for string lenght.
    Data:
      w_string type string,
      w_lenght type i.
    w_string = 'vhdskbvsdkbvdsvnsknvs'.
    w_lenght = strlen( w_string ).
    Write:
      w_lenght.
    With luck,
    Pritam.

  • How to calculate the size each PSA request or all PSA for the Datasources?

    Hi All,
    Can anybody tell me how to calculate the size of each PSA Request or all PSA's requests for all datasources?
    Regards,
    Rajesh

    Hi ,
    PSA technical name can be found as,
    1)Right click on your Data Target,go to Display dataflow,click on the PSA ,here you can find the technical name.
    2)Goto RSRV tcode>PSA Table>Consistency between PSA Partitions and SAP Administration-->Give your Infosoure name,it gives u PSA technical name also,
    Thanks&Regards,
    Praveena.

  • How to calculate image size

    How do I calculate the size of image dynamically reading from the local server location.

    use FILE_GET_SIZE of CL_GUI_FRONTEND_SERVICES class.

  • How to calculate the size of DB given the transaction and the INVT

    Hi,
    I need to know the size of a database
    transactions/day-900
    Total Items=12,200
    We are preparing for a proposal .The above is the descriptions given by the client.
    How to estimate the size of database We need to design a hardware configuration
    Can anyone help me
    Maran.

    Any clue regarding the size of the row in the 900 transactions per day?
    Will there be a single table updated per transaction or multiple tables?
    Will the transaction be of type insert mostly?
    If it is going to be insert only, then probably you can estimate the database size based on size of row * 900 transactions per day... You need to consider if there will be other tables affected via triggers.
    Also, the size of the indexes defined on these tables will contribute to the database size.
    No idea as to what do you mean by 12,200 items.
    Message was edited by:
    satishkandi

  • How to calculate the size of the heap memory? its urgent pls

    i had a task in which i need to calculate the size of the heap memory can anybody help me its urgent pls

    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    Specifically:
    max/total/freeMemory()
    http://javaalmanac.com/egs/java.lang/GetHeapSize.html?l=new

  • How to get the size of a string in bytes

    Morning,
    I’m trying to get the length in bytes of a string, the characters below are 3 byte UTF-8, but when I display
    The length of either int, looks like is double I got 120 and I think it should be 60. Any idea
    String requiredMsg = "όόόόόόόόόόόόόόόόόόόό";
    int byteCountUTF8 = requiredMsg.getBytes("UTF-8").length;
    int byteCountUTF8 = requiredMsg.getBytes().length;
    thanks

    OK, it is not 'o with acute', but rather 'Greek small omicron with tonos'.
    This page may help you sort it out:http://www.fileformat.info/info/unicode/char/3cc/index.htm.
    According to the page and to my tests, this Unicode 03CC has a 2 bytes (not 3) UTF-8 representation.
    String requiredMsg = "\u03CC";
    System.out.println(requiredMsg.getBytes("UTF-16").length);
    System.out.println(requiredMsg.getBytes("UTF-8").length);
    System.out.println(requiredMsg.getBytes().length); // In WindowsResult on my machine:
    4
    2
    1

  • How to increase the size of a String[]

    I'm using a String[] variable that I do not know the maximal size, but i need to increase its size, how can I do that
    ex:
    String[] buffer = new String[]
    int i= 0;
    while (<condition>) {
    ???? // increase the size
    buffer [ i ] =.....
    }

    There is no way in Java to actually increase or decrease the size of an existing array. You'll have to create a new array of the appropriate size and copy elements of the first array into it, for example by using System.arraycopy.
    Or you could give your array a big enough size at start, so you won't have to do the above.
    A better idea would be to use a collection instead of an array (like an ArrayList) in the first place.

  • How to calculate bytes received

    Hai
    i am transferring files in rmi by reading it contents & send it as argument to server. In this i want to find amount of bytes received by server for a file how to find this plz help me
    Thanks in advance

    From what I see, I assume that the client is making a block transfer request, and the server is responding with a byte array.
    o The simplest way to figure out the total length of the file - up front - would be to have the file transfer start with some kind of "open" (RMI) message, and have that request receive the total file size as a return value.
    o The user can total the length from each byte array, and that is how much FILE data he has received.

  • How to calculate the size and number of nodes in the btree?

    I need to determine the size of the btree nodes in the log file and the how many internal and leaf nodes in the btree. For example if I have 2.88M records approximately how much disk space is used up by the JE's internal structures? This info will help me determine the best size of the data records.

    Chad,
    Keys are stored in order in the btree. They are ordered by the custom comparator if one is used, otherwise by the default (unsigned byte) comparator.
    Key prefixing (when it is available -- remember that we're talking about a future feature here) reduces memory and disk space for the adjacent keys in a Btree node when the initial bytes of those keys are in common.
    If your keys that are adjacent (according to your custom comparator) don't have common bytes at the front, then key prefixing won't have any advantage.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to calculate the size of database (a different one)

    Hello Friends,
    I am told to move the data from server to another machine (cloning is one very good option, I agree. But I expect a different answer regarding exports and imports). so How should I go about the task. The destination machine has got unlimited space. So thats not a problem. My questions are :
    1) How should I start the task ( I generally go for studying the structures and their sizes. Is it ok ?)
    2) If I am using Unix machine and there is a limitation that my server will not support file sizes of more than 2 GB, What should I do ?
    3) Shall I have to go for a full database backup or fragment the task ? If I do that , there are many schemas, so it will become tedious. But full backup will exceed OS size limitation. What should be done ?
    4) Is there anyway, I can go through a dump file, to find out, the database objects present inside that and note the related dependencies.
    Please respond.
    Regards,
    Ravi Duvvuri

    1) They are Unix machines. So will the size problem occur(if there is a limitation). How to overcome that?
    If the OS are of the same version you will have any problem. Regarding the storage only you have to have space in disk to store the datafiles, redo logs and controlfiles and nothing else.
    2) I am trying Export/import measure. Though there are other good methods, I just want to explore the full capabilities of Exp/Imp
    r.- Recreate the controlfiles is more effective and fast if the OS are of the same version.
    3) And the oracle version is 9i 2. (If I have to perform this on 8i (both source and destination, will the methods are going to differ ?)).
    R.- The method is the same for 8i/9i/10g.
    How should I go about doing this export/import ?
    r.- To use this method you have to have the original database started.
    To recreate the controlfile without having the datafile that you mentioned you have to get out it from the CREATE CONTROLFILE sentence and that's it.
    For Example: I mean, if your database has 8 datafiles and you have only 7, you have to include only 7 in the CREATE CONTROLFILE sentence.
    Joel Pérez
    http://otn.oracle.com/experts

Maybe you are looking for

  • File name with symbols won't delete from trash.cache\trash\cache folder.

    found this weird file name with symbols (squares nad the like) in the trash.cache\trash\cache folder. Can't seem to delete it from windows, can't get at from the dos prompt. Windows safe mode won't delete it. Any suggestions as to what it is and how

  • How can I change which computer taht is my main?

    How can I change which computer that is my main without loosing all my APPS, all my music etc when I sync? When I first used my iPhone i was on my work computer, but now I can't sync it on my home computer without loosing all data? That isn't a good

  • How can I pass a variable to an applet in JSP?

    I want to invoke an Applet in JSP and pass a variable( ie. port) to the Applet. I do as follows: <applet code="best.Applet1.class" width=400 height=300 > <param name=port1 value=port> </applet> in Applet1.java , I use getParameter("port1"),yet I got

  • How to change the font of the logical column heading

    I have a situation here. I have created some logical column in the rpd. When using those columns in the answers the font of the logical column is different and small to that of the other column from the same table, which looks odd. for example: Distr

  • I feel silly: Music plays only thru iPhone, not Bose speaker, when docked

    Hi--I've read the threads on the Bose Sound Dock and they seem to conclude that yes, the iPhone is compatible with the Sound Dock as long as you put it in Airplane Mode. No problem with that--but when I dock it, the sound is still coming only from th