Length of a string (text) in pixels.

I'm trying to locate a String's center on an exact position, drawing it to a JPanel. But since i don't know the exact length of the string, it's not that easy. Can anybody help me out there?

import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import javax.swing.*;
public class CenteringStrings
    public static void main(String[] args)
        StringDemoPanel demo = new StringDemoPanel();
        DemoActionPanel action = new DemoActionPanel(demo);
        JFrame f = new JFrame("Centering Strings");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(action, "East");
        f.getContentPane().add(demo);
        f.setSize(500,300);
        f.setLocation(200,200);
        f.setVisible(true);
class StringDemoPanel extends JPanel
    String text;
    Font font;
    final int
        ASCENT   = 0,
        DESCENT  = 1,
        LEADING  = 2,
        BASELINE = 3;
    int index = -1;
    boolean sizeFlag, boundsFlag;
    public StringDemoPanel()
        text = "Centered text";
        font = new Font("lucida sans oblique", Font.PLAIN, 36);
        sizeFlag = false;
        boundsFlag = false;
        setBackground(Color.white);
    public void paintComponent(Graphics g)
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setFont(font);
        FontRenderContext frc = g2.getFontRenderContext();
        LineMetrics lm = font.getLineMetrics(text, frc);
        TextLayout tl = new TextLayout(text, font, frc);
        int w = getWidth();
        int h = getHeight();
        float textWidth = (float)font.getStringBounds(text, frc).getWidth();
        float ascent  = lm.getAscent();
        float descent = lm.getDescent();
        float leading = lm.getLeading();
        float height  = lm.getHeight();
        float x = (w - textWidth)/2;
        float y = (h + height)/2 - descent;
        g2.drawString(text, x, y);
        // marker for string origin (x,y) on baseline
        //g2.setPaint(Color.blue);
        //g2.fill(new Ellipse2D.Double(x - 1, y - 1, 2, 2));
        // physical space of text
        Rectangle2D textSize = tl.getBounds();
        textSize.setFrame(x, y - textSize.getHeight(),
                          textSize.getWidth(), textSize.getHeight());
        // string bounds
        Rectangle2D bounds = font.getStringBounds(text, frc);
        bounds.setFrame(x, y - ascent - leading, bounds.getWidth(), bounds.getHeight());
        switch(index)
            case ASCENT:
                Rectangle2D r1 = new Rectangle2D.Double(x, y - ascent, textWidth, ascent);
                g2.setPaint(Color.magenta);
                g2.draw(r1);
                break;
            case DESCENT:
                Rectangle2D r2 = new Rectangle2D.Double(x , y, textWidth, descent);
                g2.setPaint(Color.orange);
                g2.draw(r2);
                break;
            case LEADING:
                Rectangle2D r3 = new Rectangle2D.Double(x, y - ascent - leading,
                                                        textWidth, leading);
                g2.setPaint(Color.yellow);
                g2.draw(r3);
                break;
            case BASELINE:
                Line2D line = new Line2D.Double(x, y, x + textWidth, y);
                g2.setPaint(Color.blue);
                g2.draw(line);
        if(sizeFlag)
            g2.setPaint(Color.green);
            g2.draw(textSize);
            System.out.println("above size = " + (int)textSize.getY() + "\n" +
                               "below size = " +
                               (int)(h - (textSize.getY() + textSize.getHeight())));
        if(boundsFlag)
            g2.setPaint(Color.red);
            g2.draw(bounds);
            System.out.println("above bounds = " + (int)bounds.getY() + "\n" +
                               "below bounds = " +
                               (int)(h - (bounds.getY() + bounds.getHeight())));
    public void setIndex(int i)
        index = i;
        repaint();
    public void setSizeFlag(boolean flag)
        sizeFlag = flag;
        repaint();
    public void setBoundsFlag(boolean flag)
        boundsFlag = flag;
        repaint();
class DemoActionPanel extends JPanel
    StringDemoPanel sdp;
    JRadioButton
        ascentButton, descentButton, leadingButton, baselineButton, clearButton;
    JRadioButton[] buttons;
    JCheckBox
        sizeCheck, boundsCheck;
    JCheckBox[] checks;
    public DemoActionPanel(StringDemoPanel p)
        sdp = p;
        createComponents();
    private void createComponents()
        ascentButton   = new JRadioButton("ascent");
        descentButton  = new JRadioButton("descent");
        leadingButton  = new JRadioButton("leading");
        baselineButton = new JRadioButton("baseline");
        clearButton    = new JRadioButton("clear");
        buttons = new JRadioButton[] {
            ascentButton, descentButton, leadingButton, baselineButton, clearButton
        ButtonGroup group = new ButtonGroup();
        RadioButtonListener buttonListener = new RadioButtonListener();
        setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.weighty = 1.0;
        gbc.insets = new Insets(2,2,2,2);
        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.WEST;
        for(int i = 0; i < buttons.length; i++)
            add(buttons, gbc);
group.add(buttons[i]);
buttons[i].addActionListener(buttonListener);
sizeCheck = new JCheckBox("text size");
boundsCheck = new JCheckBox("bounds");
checks = new JCheckBox[] { sizeCheck, boundsCheck };
CheckBoxListener checkBoxListener = new CheckBoxListener();
for(int i = 0; i < checks.length; i++)
add(checks[i], gbc);
checks[i].addActionListener(checkBoxListener);
private class RadioButtonListener implements ActionListener
public void actionPerformed(ActionEvent e)
JRadioButton button = (JRadioButton)e.getSource();
if(button == clearButton)
sdp.setIndex(-1);
return;
for(int i = 0; i < buttons.length; i++)
if(button == buttons[i])
sdp.setIndex(i);
break;
private class CheckBoxListener implements ActionListener
public void actionPerformed(ActionEvent e)
JCheckBox checkBox = (JCheckBox)e.getSource();
if(checkBox == sizeCheck)
sdp.setSizeFlag(sizeCheck.isSelected());
if(checkBox == boundsCheck)
sdp.setBoundsFlag(boundsCheck.isSelected());

Similar Messages

  • Determining the actual length of a string based on pixels?

    How would you determine the actual length of a string based on pixels? Reason for is because a length of a string containing all " l " chars would be a lot smaller then the length of a string containing all "H" chars based on pixel width.
    thanks,
    newbie

    Yes, look at the FontMetrics class which has methods to do just that. To get a relevant FontMetrics object, try "x.getFontMetrics(f)" where x is a Component and f is the Font your string is represented in.

  • Length of text in pixels?

    hi, is there any function that gives you the length of a string in pixels? For example, an "i" is a lot smaller than a "m". I currently have a statement like this...
    g.drawString(stringVariable,50-(stringVariable.length()*3),50)
    that gives aproximately centered text... But if I were to type 10 "i"s then it would be way off to the left of 50,50 and if I typed 10 "m"s it would be way off to the right of 50,50, somebody please help on this.

    Hm, I did a little looking up about fontMetrics, and I found my answer, thanks.

  • How can i get the length of a string with Simplified Chinese?

    when i use eventwriter to add content to a xmldocument,there are some chinese simplified string in it,i use String.length() for the length ,but it is not correct~how can i get the right length for eventwriter?

    Below is a simple patch for this problem. Using this patch you need to pass 0 as the length argument for any XmlEventWriter interfaces that take a string length.
    Regards,
    George
    diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
    *** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp    Fri Nov  3 12:26:11 2006
    --- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp      Thu Mar 15 13:58:13 2007
    *** 234,239 ****
    --- 234,241 ----
            CHECK_NULL(text);
            CHECK_SUCCESS();
    +       if (!length)
    +               length = ::strlen((const char *)text);
            if (!_current)
                    throwBadWrite("writeText: requires writeStartDocument");
            try {
    *** 413,418 ****
    --- 415,422 ----
            CHECK_NULL(dtd);
            CHECK_SUCCESS();
    +       if (!length)
    +               length = ::strlen((const char *)dtd);
            if (_current) {
                    if (!_current->isDoc())
                            throwBadWrite("writeDTD: must occur before content");
    diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp
    *** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp Tue Jan  2 16:01:14 2007
    --- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp   Thu Mar 15 13:59:25 2007
    *** 326,331 ****
    --- 326,333 ----
                    needsEscape = false;
            else
                    needsEscape = true;
    +       if (!length)
    +               length = ::strlen((const char *)chars);
            writeTextWithEscape(type, chars, length, needsEscape);
    *** 336,341 ****
    --- 338,345 ----
                                  bool needsEscape)
            if(_entCount == 0) {
    +               if (!len)
    +                       len = ::strlen((const char *)chars);
                    if ((type == XmlEventReader::Characters) ||
                        (type == XmlEventReader::Whitespace)) {
                            char *buf = 0;
    *** 381,386 ****
    --- 385,392 ----
      NsWriter::writeDTD(const unsigned char *data, int len)
            if(_entCount == 0) {
    +               if (!len)
    +                       len = ::strlen((const char *)data);
                    _stream->write(data, len);
      }

  • How is the length of a string calculated in Java?  and JavaScript?

    Hi all,
    Do any of you know how the length of a string is being calculated in Java and JavaScript? For example, a regular char is just counted as 1 char, but sometimes other chars such as CR, LF, and CR LF are counted as two. I know there are differences in the way Java and JavaScript calculate the length of a string, but I can't find any sort of "rules" on those anywhere online.
    Thanks,
    Yim

    What's Unicode 4 got to do with it? 1 characteris 1
    character is 1 character.
    strings now contain (and Java chars also) is
    UTF-16 code units rather than Unicode characters
    or
    code points. Unicode characters outside the BMPare
    encoded in Java as two or more code units. So it would seem that in some cases, a single
    "character" on the screen, will require two charsto
    represent it.So... you're saying that String.length() doesn't
    account for that? That sux. I don't know. I'm just making infrerences (==WAGs) based on what DrClap said.
    I assume it would return the number of chars in the array, rather than the number of symbols (glyphs?) this translates into. But I might have it bass ackwards.

  • Length of a string in a combobox exceeds the width of the combobox

    How do you fix this:
    The length of a string in a combobox exceeds the width of the combobox and as a result, the comboBox changes its size :-(
    I don't want it to change the size even if the length of the string exceeds the width of the comboBox
    what should i do?

    ok i got it
              Dimension d =combo.getPreferredSize();
    combo.setPreferredSize(new Dimension(50, d.height));
    anyone with better solution?

  • Script to search all files in specified folder for multiple string text values listed in a source file and output each match to one single results txt file

    I have been searching high and low for this one.  I have a vbscript that can successfully perform the function if one file is listed.  It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
    that way.  However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder.  At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
    was executed and folder was scanned.  So I am going back to the drawing board and starting from the beginning.
    I also have a txt file that contains the list of string text entries I would like it to search for.  Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back.  The current script
    I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand.  It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
    let it search.  There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for.  It is a search (read) only function, going thru the entire contents of the folder and
    when done, performs the loop function and onto the next file to repeat the process until all files are searched.  When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
    of the overall script.  Saving yet another step for me to do.
    My current script is set to append to the same results file and will echo [name of file I am searching]:  No errors found.  Otherwise, the
    output shows the filename and the string text that matched.  Because the results append to it, I can only run the script against each file separately or create individual output names.  I would rather not do that if I could include it all in one.
     This would also free me from babysitting it and running each file script separately upon the other's completion.  I can continue with my job and come back later and view the completed report all in one.  So
    if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence).  I don't want the entire line to be listed
    where the error was, just the match itself.
    Example:  (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line.  It somehow posted the example jumbled when I listed it) 
    File1.txt Line 54 
    Job terminated unexpectedly
     File1.txt Line 58 Process not completed
    File1.txt
    Line 101 User input not provided
    File1.txt
    Line 105  Process not completed
    File2.txt
    No errors found
    File3.txt
    Line 35 No tape media found
    File3.txt
    Line 156 Bad surface media
    File3.txt Line 188
    Process terminated
    Those are just random fake examples for this post.
    This allows me to perform analysis on a set of files for various projects I am doing.  Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on.  Therefore, the
    line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
    I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using.  Very useful.
    If you know how I can successfully achieve this in one script, please share.  I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
    Thanks for helping.

    I'm sorry.  I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing  help with.   I did have one created, but I came across one that seemed more organized than what I originally created.  Later
    on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly.  Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
    However, I could still use help on it.  I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error.  If I end with End, then it still gives same
    results.
    So to give credit where I located this:
    http://vbscriptwmi.uw.hu/ch12lev1sec7.html
    I then adjusted it for what I was doing.
    What this does does is it searches thru log files in a directory you specify when prompted.  It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file:  errors.log
    Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
    What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched.  That way, I can go directly
    to each instance for particular events if further analysis is needed later on.
    So I could use help on what statement should I be closing this with.  What event, events or error did I overlook that I keep getting prompted for that.  Any help would be appreciated.
    Option Explicit
    'Prompt user for the log file they want to search
    Dim varLogPath
    varLogPath = InputBox("Enter the complete path of the logs folder.")
    'Create filesystem object
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
    'Creates the output file that will contain errors found during search
    Dim oTSOut
    Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
    'Loop through each file in the folder
    Dim oFile, varFoundNone
    VarFoundNone = True
    For Each oFile In oFSO.GetFolder(varLogPath).Files
        'Verifies files scanned are log files
        If LCase(Right(oFile.Name,3)) = "log" Then
            'Open the log file
            Dim oTS
            oTS = oFSO.OpenTextFile(oFile.Path)
            'Sets the file log that contains error list to look for
            Dim oFile2
            Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
            'Begin reading each line of the textstream
            Dim varLine
            Do Until oTS.AtEndOfStream
                varLine = oTS.ReadLine
                Set objRegEx = CreateObject("VBScript.RegExp")
                objRegEx.Global = True  
                Dim colMatches, strName, strText
                Do Until oErrors.AtEndOfStream
                    strName = oFile2.ReadLine
                    objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
                    Set colMatches = objRegEx.Execute(varLine)  
                    If colMatches.Count > 0 Then
                        For Each strMatch in colMatches 
                            strText = strText & strMatch.Value
                            WScript.Echo "Errors found."
                            oTSOut.WriteLine oFile.Name, varLine.Line, varLine
                            VarFoundNone = False
                        Next
                    End If
                Loop
                oTS.Close
                oFile2.Close
                oTSOut.Close
                Exit Do
                If VarFoundNone = True Then
                    WScript.Echo "No errors found."
                Else
                    WScript.Echo "Errors found.  Check logfile for more info."
                End If
        End if

  • If we can increase the length of the Short Text field in a purchase order?

    Hi Experts,
    Please suggest if we can increase the length of the Short Text field in a purchase order?
    If yes, How? and what will be the impact?
    Thanks
    Gavar

    Dear Arpit,
    You can use PO Text field for long description of the material.
    Regards,
    Manish Jain

  • How to find the total length of the string drawed in a rect?

    Hello Everybody,
    I am drawing a string in on one rect using drawInRect method. This drawInRect method gives us a return value as size of the rect. I need length of the string that is did draw in that rect, but didn't find any api to do this.
    Can anyone tell me , how find the length of the string which we did draw in rect?
    Any help regarding this issue , is highly appreciable.
    Thanks,
    Pandit

    Hi Adreas,
    First of all, very thanks for the response.
    Actually , I am looking for other thing. Using drawInRect method I am drawing contentString in self.rect like below.
    //code
    [contentString drawInRect:self.rect withFont:[UIFont fontWithName:@"Verdana" size:14.0] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
    //End
    My contentString is much larger string, so I am not able to draw it in rect(length: 320.0 height: 460.0) completely. My rect is showing only a part of a contentString. So I need to get that part of string which did draw in the rect, so that I can process my contentString to get the remaining string to draw it a next rect.
    The above code statement is returning me the CGSIZE , it is giving the size of the rect but not giving any information of the string which get draw in that rect.Do you have any idea how to do this?
    Any information on this is highly appreciable.
    Thanks,
    Pandit

  • How to change string text in xaml

    I have string text in ListPickerItem like this
    <toolkit:ListPicker x:Name="items" FullModeHeader="Items" Background="White" Margin="10,280,14,0" VerticalAlignment="Top" Foreground="Black" FontSize="25.333">
    <toolkit:ListPicker.Header>
    <TextBlock x:Name="Choose_Items" Opacity="0.8" Text="Choose Items" Foreground="White"/>
    </toolkit:ListPicker.Header>
    <corelib:String>item1</corelib:String>
    <corelib:String>item2</corelib:String>
    <corelib:String>item3</corelib:String>
    <corelib:String>item4</corelib:String>
    <corelib:String>item5</corelib:String>
    <corelib:String>item6</corelib:String>
    <corelib:String>item7</corelib:String>
    <corelib:String>item8</corelib:String>
    </toolkit:ListPicker>
    So in code I want to change this text by the resource each string have another value like this
    And the code is
    Public Shared Iterator Function FindVisualChildren(ByVal obj As DependencyObject) As IEnumerable(Of DependencyObject)
    If obj IsNot Nothing Then
    For i As Integer = 0 To VisualTreeHelper.GetChildrenCount(obj) - 1
    Dim child As DependencyObject = VisualTreeHelper.GetChild(obj, i)
    If child IsNot Nothing Then
    Yield child
    End If
    For Each subChild In FindVisualChildren(child)
    Yield subChild
    Next
    Next
    End If
    End Function
    Private Sub Change()
    Dim rm As New ResourceManager("App.Resource1", GetType(MainPage).Assembly)
    Dim main As Grid = ContentPanel
    Dim result = FindVisualChildren(main)
    Dim ST = result.OfType(Of String)()
    For Each item In ST
    item = rm.GetString(item.Text)
    Next
    End Sub
    So How I can make right code to run like this problem ??
    Thanks :)

    Hi Shay Boshra,
    Based on your description, it seems that you want to change the ListPickerItem content based on the resource file, if I do not misunderstand you, an easy way to implement it is that first you can define the ListPicker as following:
    In the MainPage.xaml:
    <toolkit:ListPicker x:Name="items" Background="White" Margin="0,-11,24,0" VerticalAlignment="Top" Foreground="Black" FontSize="25.333">
    <toolkit:ListPicker.Header>
    <TextBlock x:Name="Choose_Items" Opacity="0.8" Text="Choose Items" Foreground="White"/>
    </toolkit:ListPicker.Header>
    <toolkit:ListPickerItem Content="item1"></toolkit:ListPickerItem>
    <toolkit:ListPickerItem Content="item2"></toolkit:ListPickerItem>
    <toolkit:ListPickerItem Content="item3"></toolkit:ListPickerItem>
    <toolkit:ListPickerItem Content="item4"></toolkit:ListPickerItem>
    <toolkit:ListPickerItem Content="item5"></toolkit:ListPickerItem>
    </toolkit:ListPicker>
    <Button Content="Change Text" HorizontalAlignment="Left" Margin="20,446,0,0" VerticalAlignment="Top" Click="Button_Click" Width="299"/>
    In the MainPage.xaml.cs:
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    Dim ResourceManager As New ResourceManager("App.Resource1", GetType(MainPage).Assembly)
    For Each listpickitem As ListPickerItem In items.Items
    listpickitem.Content = ResourceManager.GetString(listpickitem.Content.ToString())
    Next
    End Sub
    The result:
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to display only specified length of characters in text control

    Hi,
    I am using text control in swf file. In this file, i want the display text upto 15 charaters and if more, then present with [.....]
    Please provide solution for this.

    Here ya go   For 15 character limit...
    <mx:Label text="{(textInputA.text.length > 15)?textInputA.text.substr(0,15)+'[...]':textInputA.text}"/>
    This uses textInputA as a textInput box that someone can type into.  The result is that in the Text/Label component, it checks the length of the value of textInputA and if it's longer than 15 characters, it trims any characters beyond 15 and adds [...] to the end.
    You can substitute other things instead of a textInput control, but I used it here as it's the easiest way to explain.
    Let me know if this helps you

  • Length of a string without using any built-in functions

    code that returns the length of a string without using any built-in functions.
    thanks
    Sam

    A string is internally represented by a character array.  An array of characters will reside on the stack, not the heap.  Yes, we always learned that String is a reference type, but what goes on in your memory might still surprise you...
    A struct is internally represented by only it's private properties, sequentially on the stack.
    So basically, what I thought is happening by messing with the structlayout: is only tricking our programming a bit into thinking that the top X bytes on the stack represent a chararray, while actually we put them there as a string.
    Wrong. True. And wrong.
    A string is internally represented by, in that order, an array length, a string length, the chars. None of them resides on the stack.
    An array is internally represented by, in that order, an array length and the chars. None of them resides on the stack.
    When you use the FieldOffset attribute to handle the string as a char array, you don't get anything right:
    - the Length returned is the "array length" of the string, which is equal to the string length + 1.
    - the chars returned by the array indexer are shifted by 2 chars (the length of the "string length" field).
    You can use the FieldOffset to make that work, but it needs a little bit more work.
    unsafe static int Test()
    string myString = "This string may contain many string inside this string";
    string testString = "string";
    int countResult = 0;
    fixed (char* myChars = new StringToChar { str = myString }.chr, testChar = new StringToChar { str = testString }.chr)
    // The 2 first chars of the array are actually the string length.
    int myCharsLength = myChars[1] << 16 | myChars[0];
    int testCharLength = testChar[1] << 16 | testChar[0];
    for (int i = 0; i < myCharsLength - testCharLength + 1; i++)
    if (myChars[i + 2] == testChar[2])
    for (int j = 1; j < testCharLength; j++)
    var c = testChar[7];
    if (myChars[i + 2 + j] != testChar[j + 2])
    goto endOfCharAnalyses;
    countResult++;
    endOfCharAnalyses:
    continue;
    return countResult;

  • Length of the string passed to rwcgi60 in Oracle 6i

    Hello,
    I am running the report from the web. The url will be something like
    http://localhost/cgi-bin/rwcgi60.exe?server=repserver+report=.rep+all the input parameters.
    When the length of the string passed from report= execeeds certain limit(indicated by dashes) I am getting the cgi error
    Error: The requested URL was not found, or cannot be served at this time.
    Oracle Reports Server CGI - Unable to communicate with the Reports Server.
    If I remove some of the select criteria then I could execute the report from the web.
    Any body has any soln. for this.
    Thanks in advance,
    Vanishri.

    Vanishri
    The limit is very high and you should not be hitting this problem. There are couple of fixes done in this area. Please apply the latest patch (Patch 10) and try.
    Other solution is you can have a mapped key in cgicmd.dat file and use the key alone in the URL. In the cgicmd.dat file, you have to map say
    key1: REPORT=your_report.rdf USERID=user_name/password@mydb DESFORMAT=html
    SERVER=repserver DESTYPE=cache
    Please refer to the Publishing reports or Reports services manual at http://otn.oracle.com/docs/products/reports/content.html
    Thanks
    The Reports Team

  • PowerShell: Want to get the length of the string in output

    Hi All,
    I am typing this but it is not working. Does anyone know what I could be doing wrong.
    The command I wrote is:
                         GCI -file  | foreach {$_.name} | sort-object length | format-table name, length
    But it is not working. I am expecting a name of the file and length of the string like 8 characters etc. my file is called mystery so it should have 7 as its output of the name, length.
    Thank-you
    SQL 75

    Get-ChildItem supports both  -File and -Directory.
    Help will help:
    https://technet.microsoft.com/library/hh847897(v=wps.630).aspx
    Read the first couple of parameters to see.
       GCI -file  | sort-object length | format-table name, length | ft -auto
    Seems to be a rasher of bad answers to day.  YOu were just extracting the name property then trying to sort on a property that doesn't exist.
    Do the sort first then select the properties.
    it helps to test answers before posting.  I know because I get bit by posting without thinking to often.  I have to remember to think first.
    ¯\_(ツ)_/¯

  • When i insert string text in hebrew i see ?????????

    hi
    when i insert string text in hebrew i see ????????? how to fix it ?
    i work on:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    Oracle Developer ver. 2.1.1.64
    thanks

    i try this, but still same problem :(
    my Settings:
    NLS_LANGUAGE     AMERICAN
    NLS_TERRITORY     AMERICA
    NLS_CURRENCY     $
    NLS_ISO_CURRENCY     AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CHARACTERSET     IW8MSWIN1255
    NLS_CALENDAR     GREGORIAN
    NLS_DATE_FORMAT     DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_SORT     BINARY
    NLS_TIME_FORMAT     HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY     $
    NLS_COMP     BINARY
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_RDBMS_VERSION     11.2.0.1.0

Maybe you are looking for

  • Xml publisher report using RTF in Excel is coming as wrap text?

    Hi, I am working on XML publisher report, I have converted standard report to xml publisher , to generate the report in excel. But the output is coming as Wrap text, is there a way to get the output directly without wrap ? Thanks Dev

  • Multiple SQLs INSERT in a single SQL with O.Lite on PDA

    Hi, We are using(and new to) Oracle on PDA, dvlping in JAVA. We need to increase performance and reliability to make multiple INSERT in a single SQL statement, dynamically created : We've got a syntax error when executing this : INSERT INTO t1 (row1,

  • How to delete unwanted movie downloads in progress on my iPad

    I have several TV Show downloads that I no longer want downloaded on my iPad.  How can I del

  • Deffered tax node not available in General Ledger Accounting

    Hello, I want to custumize deffered tax programme but the node :General Ledger Accounting  Business Transactions  Report  Sales/Purchases Tax Returns  Deferred Taxes is not availabe. Please suggest what steps are needed to make it available. ours

  • Cannot start server from console

    It seems that this problem has been reported before but I have not found anybody posting a solution. I followed the instructions to install sp7 and am getting this error. Can anyone help out since we are also stuck on this one. An additional note is