Inserting a character in an array
i already have this piece of code:
int length1=name1.length();
int length2=name2.length();
for(int g=0; g<length1; g++){
for(int k=0; k<length2; k++){
if(name2.charAt(k)==name1.charAt(g)){
if(name2.charAt(k)!=' '){ //excludes spaces to be inserted in the array
/*inserting of the character in the array is supposed to be here..but i dont know how it is done. im trying not to use classes.*/
im trying to insert characters in an array that is found in both name1 and name2. there should be no same characters found in the array.
a charachter array sounds allot like a String which has very useful methods like: indexOf, contains and replace, replaceAll. Have a look:
[http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html]
Similar Messages
-
I have an sgm file which contains special characters in different languages.
<!DOCTYPE MANUAL PUBLIC "-//SWE-XXX//DTD XXX MANUAL-DTD 2.0//EN">
<MANUAL LANG="CS">
<TITEL>
Polish characters: óê¿ñæÑÆÊ¥Ó£
Czech characters: éìóïáøèíùòú&Og rave;ÌÉÓÚÙÈØÍÁÏ aacute: á</TITEL>
</MANUAL>
Is there any way to insert special character directly in sgm file, so that it won't have to be interpreted by isoents mapping rules?
isoent.rwr interpretes oacute as:
entity "oacute" is fm char 0x00F3;
But I would like to use 0x00F3 directly in fm file, so that if any additional character is needed - I won't have to update isoent files
I've tested already:
ó
&x00F3;
&0x00F3;
but with no luck
Is there anyone who could help me with it?
I will really appreciate your help
/JoannaHi Michael. Thank you for your reply.
There is no declaration within sgm file itself - but while opening the file I use sgml application definition with the following settings:
Default API client: FmTranslator
SGML character encoding: ISO Latin1
XML character encoding: UTF-8
Namespace: Enable
CSS2 Preferences:
Generate CSS2: Disable
Add Fm CSS Attribute To XML: Disable
Retain Stylesheet Information: Disable
Entity locations
Entity search paths
C:\Program Files\Adobe\FrameMaker9\Structure\sgml\isoents
So as you can see, character encoding is set to ISO Latin1 (there is no way to use UTF-8 encoding in sgml files)
Typing ź or ć in sgm document and opening it with framemaker sgml application - I receive: ¿æ and message: "Non-SGML character found; should have been character reference"
Everything works fine when I type f.ex.: &x016B; and insert appropriate reference lines into isolat1.rw and isolat1.ent files
But what I would like to avoid is editing those isoent files each time new character is be needed. -
How to insert special character from Oracle form builder 10g
Dear all,
I need help. how to insert special character like 'Superscript or Subscript ' from oracle form builder 10g. I had try in Oracle form builder 6i with press ALT+ASCII code in the text item and it work, but in the oracle form builder 10g this method doesn't work... would you like to help me...somebody please...
Best Regard,
Dedy P.T.What do you mean by insert ... from Forms Builder? Do you mean you want to add it as text in a string of pl/sql code or as part of boiler plate text (label) or a value on the Property Palette?
For special characters you would need set NLS_LANG to something that would support the characters you want to use. For the Builder to see the change, you would need to set NLS_LANG to something like:
NLS_LANG=AMERICAN_AMERICA.UTF8
This can be done in the Windows Registry or system. As I mentioned, this will only apply to the Builder and will have nothing to do with a running form. For running forms you would need to set this in default.env. As for things like super and sub scripts, these are font formats and not necessarily characters. For the most part, I don't believe these are supported in Forms. -
In OS 10.6 I could go >edit>special characters: view glyph, glyph Catalog, Font: <font name> and I would see a table of each character in a font. Then, I could select a character and either drag it to my document or click Insert Font in the lower right hand corner and it would put the character into the document.
How do I do the same thing in OS 10.8.5? How do I insert a character into a document through fontbook or any other manner?You need to use another app for this, like Ultra Character Map or Popchar.
This should only be necessary if you are using a non-standard font, which may not be a good idea (since there is no guarantee your glyph will be seen by anyone else). If the character exists in Unicode, you should be able to find it in Character Viewer and input via double-click or drag/drop.
If you provide examples of what you need to input, I can perhaps tell you how to find them. -
Inserting Chinese character using sqlplus
I am not able to insert Chinese character using sqlplus .
Am getting disconnected when trying to insert.
with no error
message coming
is disconnected form oracle enterpise 10.2.0.2.0 with .. mining..
Please help.sql is simple insert statement
insert into t5(txt) values ('中中 中 中 中 中 中 中 中 中 ');
os is AIX
I wonder when i using sql developer I am able to insert.
regarding environmental variable , I am not setting any variable regarding NLS.
I simply connect sqlplus username/password
when I execute following statement
sqlplus disconnect without giving any error.
question is why sql developer is able able to insert and sqlplus not
Thanks for reply -
Hihow to insert 2 elements into 2D array?
Hi I had a hard time figuring out how to insert 2 elements into 2D arrays.
I tried using replace and insert array functions but it does not work right way.
I am using LV7.1. See the pic below.
How do I insert elements in that way?
Pls advise
ClementWell, "replace array subset" is not the right tool, because it keeps the size of the array constant. Insert into array only works for entire rows or columns.
You need a hybrid approach, because you want to insert elements at the beginning of column 1 while padding the remaining columns to the new lenght of column 1. This won't be efficient but there are plenty of ways to do that (here is one example with DBL arrays, should work equally well for string arrays as in your case).
How much flexibility do you need? Is it always at the beginning of the first column? Are the arrays huge (=is performance an issue)? Is this a rare operations or do you constantly need to do this (e.g. inside a loop).
In any case this seems like a rather arbitrary and somewhat silly operation. What is the practical purpose?
LabVIEW Champion . Do more with less code and in less time .
Attachments:
WeirdMerge.vi 21 KB -
Inserting Special Character using SQL*Plus
I am trying to insert special character like ® using SQL*Plus but it is inserting a .(dot) instead.
Environment:
Oracle Enterprise version : 9.2.0.3.0
Sun Solaris 8
Any help will be appreciated.
Regards,
NirmalyaThat's the reason I use ASCII values always for special characters.
SQL> create table sample1(col1 varchar2(50))
2 /
Table created.
SQL> insert into sample1
2 select 'The temperature outside is 20'||chr(176)||' centigrade' col1
3 from dual
4 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> select * from sample1
2 /
COL1
The temperature outside is 20° centigrade
1 row selected.
SQL> drop table sample1 purge
2 /
Table dropped.
SQL> Cheers
Sarma. -
How do I insert an object in an array?
How can I insert an object in an array of variable size?
I input two numbers from keyboard
1
2that form the following object (Pair)
(1,2)
how can I add such objects to an array
private Pair s[];
e.g.
public PairList(int x){
top = -1;
s = new Pair[x];
}//constructor
public void getPairs()throws FullException{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
try{
a=input.readLine();b=input.readLine();
}//try
catch(IOException e){System.out.println("Can't read input");}//catch
int x=0;
int y=0;
try{
x=Integer.parseInt(a);}//try
catch(NumberFormatException e){}
try{
y=Integer.parseInt(b);}//try
catch(NumberFormatException e){}
Pair k=new Pair(x,y);
System.out.println(k);
s[++top]=k; --here is my problem
}//getPairsI tried making as few changes to your code as possible, but your idea should basically work. Potential problems:
1. Doesn't allow for more input than 1 pair.
2. By storing pair in an array, you must know the exact size of the array you will need beforehand. You might be better off storing the Pair(s) in a Vector and then converting that to an array.
3.Your exception handlers need some work. Basically, your exception handlers put out a message or do nothing and then you continue processing. Not good.
4. No cleanup of file resources after you have completed
import java.io.*;
public class PairList{
private Pair s[];
private int top;
public PairList(int x){
top = -1;
s = new Pair[x];
}//constructor
public void getPairs()throws Exception{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String a = null, b = null;
try{
a=input.readLine();
b=input.readLine();
}//try
catch(IOException e){
System.out.println("Can't read input");
}//catch
int x=0;
int y=0;
try{
x=Integer.parseInt(a);
}//try
catch(NumberFormatException e){
try{
y=Integer.parseInt(b);}//try
catch(NumberFormatException e){
Pair k=new Pair(x,y);
System.out.println(k.toString());
s[++top]=k; //here is my problem
}//getPairs
class Pair {
private int xx;
private int yy;
public Pair(int x, int y) {
xx = x;
yy = y;
public String toString() {
return("X = " + xx + " Y = " + yy);
} -
Last One I Promise! Inserting A Value In An Array And Shifting TheRest Over
Last question I have, I need to know the theory behind inserting a value into an array and shifting the rest over.. I have somewhat of an idea and that is this:
Obviously I need to use a for loop, and a temp value to hold each value until it shifts then move on to the next value? Oh and increase the size of the array by one? I'm having trouble making sense of it..
lets say we have the same array as from before
int[] aRay = new int[5];
aRay[0] = 1;
aRay[1] = 9;
aRay[2] = 3;
aRay[3] = 4;
aRay[4] = 11;
and we want to add... lets say the element 5 into the index spot of 2 is and shift 2 to 3 and 3 to 4 and 4 to 5.
for ( int i = 0; i < aRay.length; i++) // this will move along each element of the array (so I know I need this for sure)
Am I on the right track? thanks all
Edited by: Jojobaba on May 13, 2008 11:50 PM
Edited by: Jojobaba on May 13, 2008 11:54 PMJojobaba wrote:
I can do all that, the only trouble I'm having right now is what's the correct way to increase the size of the array by one more? if I try to declare 4 as 5 it gives me a runtime error because 5 is out of bounds, and rightly so, because it doesn't exist
Once I get that, the rest will be cake
int[] aRay = new int[5];
^
l
l
Do I just make this a 6? or is that not the right way.. :/You can't change array sizes dynamically. You will have to make a new array of the appropriate size and copy into it. You could use copyOf: http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#copyOf(int[],%20int)
I hope this is purely an academic exercise, because there's no reason to do this. -
Inserting a record into an array
I have an applet that pops up different frames when you click on a menu item. On my add a record frame I have a number of textfields and an add button. When the button is clicked it is supposed to insert the record into my array of objects that only can have 3 records. When the button is clicked however I get a null pointer exception. I want to add the record in order based on the employee number, so first I want to check to see if the first spot of the array is null and add the record in the first spot if it is. If it isn't I want to check the employee numbers and insert the the record in the correct place and make sure the array isn't full. Can someone help me out 1. Why the nullpointer exception. 2. I am not sure if my logic is correct. Below is the Code. Thanks!!
public void insertRecord()
if (MyEmpArray[0] == null )
addRec(0);
else
for(int index =0; index <3; index++)
if(intEmpNumber < MyEmpArray[index].intEmpNumber && MyEmpArray[3] != null )
addRec(index);
else
lblErrorMessage.setText("Array is full");
public void addRec(int index)
MyEmpArray[index].setValues(intEmpNumber, strFirstName, strLastName, strHomePhone,
strStreet, strCity, strState, strZip, strCountry, strWorkStreet,
strWorkCity, strWorkState, strWorkZip, strWorkCountry, strWorkPhoneNum,
fltNumHours, fltHourlyWage, intI, intJ, intK);
lblErrorMessage.setText("");
txaReport.setText("");
ClearFields();
}for(int index =0; index <3; index++)
An array with an index from 0 to 3, contains 4 records: you should replace it with
for(int index =0; index <2; index++)
The check-logic is good enough, but there are two minor "bugs":
1) even If the array is full, the for cycle will uselessly check all the records
2) if a the employee number of intEmpNumber is > thanMyEmpArray[index].intEmpNumber the program will show up "Array is full" even if the array isn't full.
So, I suggest to add more code to make distinction between the two cases:
for(int index =0; index <3; index++)
if(MyEmpArray[3] != null ) // check if there is space to add a record
if (intEmpNumber < MyEmpArray[index].intEmpNumber) //check if the position is right
addRec(index);
else
lblErrorMessage.setText("Array is full");
break; // exit the for cicle as the array is full
I don't know what you are programming, but I ask you: "If the new intEmpNumber is < than the intEmpNumber of an already-full-array shouldn't be the new record inserted, discarding the last one?"
I don't know if addRec works, I'm don't know applets, buttons..:)
Sorry for my bad english...I hope this post will help you anyway :) -
How do I convert an ASCII character to an array of co-ordinates.
I need to convert and ASCII character to an array of X, Y co-ordinates. I also need to be-able to vary the size of the text (scale of graph i suppose) and position on the graph So i can desplay multiple characters on a graph. However it needs to be stored in an array (or set of arrays) so i can isue these co-ordinates to an instrument.
Maybe the attached VI can help. Using picture control functions, it get the
1bit bitmap of the character/text
on input in a 2D array of booleans.
Jean-Pierre Drolet
"m0mbaj0mba" a écrit dans le message news:
[email protected]..
> I am trying to find a simple way to convert a letter (ASCII character)
> into an array of X,Y co-ordinates. I am involved in two projects that
> involve spelling letters with lasers. At the moment we are plotting
> the points on a graph in excel, transferring the co-ordinates into a
> text file and then converting the content of these text files into a
> set on 1D arrays. As I am sure you can appreciate this is a very long
> winded process. Is there anyway of pl
otting points on an X,Y, graph
> and outputting those points to an array or set of arrays?
>
> Excel spreadshett is attached.
[Attachment GetTextBitmap.vi, see below]
LabVIEW, C'est LabVIEW
Attachments:
GetTextBitmap.vi 45 KB -
Script to insert a character with a given font
Hello,
I must be silly but I have searched the web for hours and could not find a solution to my "simple" problem:
I would like a script to do this:
1. set font (eg MT Extra)
2. insert a character based on unicode (eg F080)
3.revert font to previous font
This vould allow me to insert any character of any font and then continue typing my text with the regular font.
Thank you for our helpFor something basic like this you should check out the documentation that comes with ESTK, under the Help menu. "Adobe Intro to Scripting" is a good place to start.
Anyway, assuming you've got your text cursor blinking in some text, try this:
myIP = app.selection[0];
myIP.contents = "\uf080";
myIP.appliedFont = "MT Extra";
Ariel -
Difference between INSERT and EXTEND in OBPM Arrays
Hi all,
I wanted to know the diference between the EXTEND keyword and INSERT keyword while using OBPM arrays.
For e.g. if testArray is an Array then:-
What does testArray.insert mean?
And
What does testArray.extend mean?Extend inserts at the end of the array. Insert allows you to specify an index into the array where you want to insert to.
-
Inserting a Character in between a String
Dear All.
I have a string of around 60-80 characters and its length depends at run time. Now I would like to insert a character value between the 3rd and the 4th character of the string.
E.g : Str1 = '020BUPATEXAS...'
Now I would like to insert a value 'E' between a 3rd charactre and 4th character as below:
Str1 = '020EBUPATEXAS....'
Can anyone throw some light on this.
Regards, VinayHi,
Another solution witout new variable:
DATA:
str1 TYPE string
VALUE '020BUPATEXASxxxxxxx'.
CONCATENATE str1(3) 'E' str1+3 INTO str1.
Regards,
Daniel -
How to insert 300 data from associative array to backend table in PL/SQL
HI ALL,
I'm posting my code here:
Creating back end table:
Create table orlando
( id number(20),
calltype number(12),
gateway_name varchar2(25),
accounting_id varchar2(18),
start_time_system_ticks number(11),
node_time_zone varchar2(25),
start_date varchar2(10),
start_time varchar2(10),
softswitch_response number(11),
alerting number(11)
Creating package:
CREATE OR REPLACE PACKAGE r IS
type apollo_rec is record(
id number(20),
calltype number(12),
gateway_name varchar2(25),
accounting_id varchar2(18),
start_time_system_ticks number(11),
node_time_zone varchar2(25),
start_date varchar2(10),
start_time varchar2(10),
softswitch_response number(11),
alerting number(11)
TYPE bin_array IS TABLE OF apollo_rec INDEX BY BINARY_INTEGER;
PROCEDURE rr (state_array bin_array);
END ;
SET SERVEROUT ON
CREATE OR REPLACE PACKAGE BODY r IS
PROCEDURE rr (state_array bin_array) IS
BEGIN
FOR i IN 1 .. state_array.COUNT LOOP
INSERT INTO orlando(id,calltype,gateway_name,accounting_id,start_time_system_ticks)VALUES(state_array(i).id,state_array(i).calltype,state_array(i).gateway_name,
state_array(i).accounting_id,state_array(i).start_time_system_ticks);
COMMIT;
END LOOP;
END ;
END ;
I've run this code in i*SQL PLUS.But when I run this code for 5 entries there is no error but when I modify the insert statement for 300 entries(300 identifiers in the insert statement)
it gives me error:
Warning: Package Body created with compilation errors.
Errors for PACKAGE BODY R:
LINE/COL ERROR
7/2 PL/SQL: SQL Statement ignored
7/14 PL/SQL: ORA-00913: too many values
Is there any feature in PL/SQL to decrease the entries in insert statement and make the insert statement along with the program small and increase the program performance.
Edited by: 983040 on Jan 20, 2013 11:11 PMBasic example (ran on 11.2.0.3):
SQL> create table testtab( id number, day date, val varchar2(30) );
Table created.
SQL>
SQL> create or replace package TestTabLib as
2
3 type TTestTab is table of testtab%rowtype;
4
5 procedure InsertRows( rowArray TTestTab );
6
7 end;
8 /
Package created.
SQL>
SQL> create or replace package body TestTabLib as
2
3 procedure InsertRows( rowArray TTestTab ) is
4 begin
5 forall i in 1..rowArray.Count
6 insert into testtab values rowArray(i);
7 end;
8
9 end;
10 /
Package body created.
SQL>
SQL> declare
2 rowArray TestTabLib.TTestTab;
3 begin
4 --// populating the array - using a bulk fetch as
5 --// an example
6 select
7 object_id, created, object_name
8 bulk collect into
9 rowArray
10 from all_objects
11 where rownum < 11;
12
13 --// bulk insert array
14 TestTabLib.InsertRows( rowArray );
15 end;
16 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from testtab;
ID DAY VAL
100 2011/12/05 09:16:03 ORA$BASE
116 2011/12/05 09:16:04 DUAL
117 2011/12/05 09:16:04 DUAL
280 2011/12/05 09:19:09 MAP_OBJECT
365 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
367 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
368 2011/12/05 09:19:10 TABLE_PRIVILEGE_MAP
370 2011/12/05 09:19:11 TABLE_PRIVILEGE_MAP
371 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
373 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
10 rows selected.
SQL>
SQL> declare
2 rowArray TestTabLib.TTestTab;
3 begin
4 --// populating the array - using a custom build
5 --// loop example such as a Java front-end will
6 --// use reading data from user input form
7 rowArray := new TestTabLib.TTestTab();
8 rowArray.Extend(2); --// user entered 2 values
9 for i in 1..rowArray.Count loop
10 rowArray(i).id := i;
11 rowArray(i).day := trunc(sysdate);
12 rowArray(i).val := 'value '||to_char(i,'000');
13 end loop;
14
15 --// bulk insert array
16 TestTabLib.InsertRows( rowArray );
17 end;
18 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from testtab where val like 'value%';
ID DAY VAL
1 2013/01/21 00:00:00 value 001
2 2013/01/21 00:00:00 value 002
SQL>
Maybe you are looking for
-
Interface keeps changing in save for web panel
How can I set my interface to stay the same as one time the "save for web" panel shows the 4 images in a square, then the next time it shows in 4 vertical strips and then other times is shows up in horizontal strips? This might be something very simp
-
Show 2 different tables in same matrix
I am using a Matrix report format in SSRS report builder, I only have one dataset to pull Invoice Date and Applied Date to show November, December (Monthly) amounts as column format and by Region (such as Americas, APAC, EMEA, Japan, Korea). However,
-
Class properties of decedent class access scope error
There seems to be what I consider a bug in the implementation of LV 2010 property nodes. If parent has a property folder with read and write accessors and child has a property folder overriding only one of the accessors, then the non-overridden prope
-
So I got an iPhone 4 and tried to restore it with my back up from my 3GS but it's not showing up in the drop down menu. The funny thing is my wife got one too and we restored hers just fine. Also when I look in the preferences I can see the backup fr
-
Opening a new window after computations and validations
Hi all I want to open a new popUp window after a submit button is clicked but this window should open only after all the validations assosiated with this button are executed. Please note that, I want to open this window before the process associated