如何将嵌入的字符串数组转换为数组javascript(How to convert embedded string array into array javascript)
我有一个字符串格式的数组。 我如何将其转换为数组。
my_data="['A','B','C']" (Note the quotes around []) convert this to ['A','B','C']
到目前为止,我尝试了json.parse和其他字符串到数组对话没有运气。 有人可以帮忙吗?
I have an array coming in string format. How do i convert it to an array.
my_data="['A','B','C']" (Note the quotes around []) convert this to ['A','B','C']
So far i tried json.parse and other string to array conversations without luck. Can anyone please help on this?
原文:https://stackoverflow.com/questions/43355526
最满意答案
我认为一个样本脚本价值超过1000字:
转到firebird服务器计算机中的shell接口,cd到您具有读/写权限的文件夹,启动isql或isql-fb(取决于您的系统和firebird版本)并运行此脚本:
create database 'netmajor.fdb' user 'sysdba' password 'masterkey'; set autoddl off; create table netmajor_example ( netmajor_id integer not null , str_data varchar(200) , int_data integer , constraint pk_netmajor_example primary key (netmajor_id) ); create generator netmajor_gen; set term ^; create trigger netmajor_pkassign for netmajor_example active before insert position 1 AS begin if (new.netmajor_id is null) then new.netmajor_id = gen_id(netmajor_gen, 1); end ^ commit work^ set term ; ^ insert into netmajor_example (str_data, int_data) values ('one', 1); insert into netmajor_example (str_data, int_data) values ('twenty', 20); commit work; select * from netmajor_example;
看看我的机器中的结果:
; NETMAJOR_ID STR_DATA INT_DATA ;============ ============================ ============ ; 1 one 1 ; 2 twenty 20
如果您有任何疑问,请随时联系。 最好的祝福。
I think a sample script worths more than 1000 words:
Go to a shell interface in the firebird server machine, cd to a folder where you have read/write permissions, start isql or isql-fb (depends on your system and firebird version) and run this script:
create database 'netmajor.fdb' user 'sysdba' password 'masterkey'; set autoddl off; create table netmajor_example ( netmajor_id integer not null , str_data varchar(200) , int_data integer , constraint pk_netmajor_example primary key (netmajor_id) ); create generator netmajor_gen; set term ^; create trigger netmajor_pkassign for netmajor_example active before insert position 1 AS begin if (new.netmajor_id is null) then new.netmajor_id = gen_id(netmajor_gen, 1); end ^ commit work^ set term ; ^ insert into netmajor_example (str_data, int_data) values ('one', 1); insert into netmajor_example (str_data, int_data) values ('twenty', 20); commit work; select * from netmajor_example;
Take a look at the results, which in my machine are:
; NETMAJOR_ID STR_DATA INT_DATA ;============ ============================ ============ ; 1 one 1 ; 2 twenty 20
IF you have questions, don't hesitate to contact. Best regards.
相关问答
更多-
将listview的行id设置为android中数据库的主键列(Set row id of listview as primary key column from database in android)[2023-08-05]
您需要构建自定义适配器。 试试这个: public class CustomAdapter extends BaseAdapter { private Context mContext; private List> mData; public CustomAdapter(Context context, List > data) { this.mC ... -
SQL - 从第二列插入行值(作为列数据到新表)(SQL - insert row values from second column ( to new table as column data))[2023-10-16]
使用SQL的PIVOT函数查找一些示例。 这会将行交换为列以匹配新表。 链接: http : //technet.microsoft.com/en-us/library/ms177410(v = sql.105).aspx Look up some examples using SQL's PIVOT function. This will swap rows into columns to match the new table. Link: http://technet.microsoft.com/en ... -
通过主键列进行关联(Correlation via primary key column)[2022-06-10]
您的XKey日期值无效。 尝试将它们设置为月份的第一个而不是0。 Your XKey date values are invalid. Try setting them to the first of the month instead of 0. -
我找到了 。 首先添加的列已被视为主列。 但是在我的代码中它不起作用beceuse我在设计器中手动添加了一些列。尽管我删除了它们但似乎有些关于删除列的数据被保存在某处。所以我的gridview中有一些隐藏的列.i删除控件和添加一个新的 i find it . first added column have been considered as primary column . but in my code it does not work beceuse i was added some columns m ...
-
为什么这不起作用? UPDATE table SET cap = (5+(`level`*5) WHERE skillid = 55 AND class = 2 AND `level` BETWEEN 1 AND 60; Why doesn't this work? UPDATE table SET cap = (5+(`level`*5) WHERE skillid = 55 AND class = 2 AND `level` BETWEEN 1 AND 60;
-
尝试: INSERT INTO dbo.TableOnlyPK DEFAULT VALUES 您已创建下表: CREATE TABLE dbo.TableOnlyPK ( Id tinyint PRIMARY KEY IDENTITY (1, 1) ) 每次触发时: INSERT INTO dbo.TableOnlyPK DEFAULT VALUES ,您将在IDENTITY列中插入一行。 所以如果你执行: INSERT INTO dbo.TableOnlyPK DEFAULT VALUES I ...
-
当某些列未设置时,如何让mysql无法插入一行?(How do i make mysql fail to insert a row when some column is not set?)[2023-05-16]
您需要将MySQL设置为严格模式 在您的配置文件中: sql-mode="STRICT_ALL_TABLES" 编辑: 您也可以使用此查询在本地设置它(并放回): SET @mode = @@SESSION.sql_mode; SET sql_mode = "STRICT_ALL_TABLES"; INSERT...; SET sql_mode = @mode; You need to put MySQL into strict mode In your configuration file: sq ... -
在插入查询中违反主键约束而不触及PK列(violation of primary key constraint in insert query not touching the PK column)[2022-12-30]
尝试运行:DBCC CHECKIDENT('HD_DtlClm。[dim_city_province_country_t]'); 查看消息选项卡中返回的结果,并确保当前标识值等于或高于当前列值。 NB运行这甚至可以解决问题本身。 要扩展:看起来像是已经重新设置了您的标识列的内容,因此插入会导致拾取重复项。 不要以为有任何方法可以从历史上检查是什么改变了它; 最可能的候选者是具有RESEED选项的DBCC CHECKIDENT命令,或TRUNCATE操作(将重新设置为原始值)。 Try running: DB ... -
插入行而不设置主列(insert row without set primary column)[2024-04-16]
我认为一个样本脚本价值超过1000字: 转到firebird服务器计算机中的shell接口,cd到您具有读/写权限的文件夹,启动isql或isql-fb(取决于您的系统和firebird版本)并运行此脚本: create database 'netmajor.fdb' user 'sysdba' password 'masterkey'; set autoddl off; create table netmajor_example ( netmajor_id integer not nul ... -
当插入行应返回用于主键列的序列号时的jpa(jpa when insert row should return the sequence number used for primary key column)[2022-10-10]
尝试使用em.merge(),它返回刚刚保留的附加实例。 在看到生成的主键之前,您可能必须使用em.flush()。 Try em.merge(), it returns the attached instance you just persisted. You might have to em.flush() before you see the generated primary key.