目录
介绍
DataFaker 是一个用于生成假数据的Java库。该库可以生成各种类型的数据,如姓名、地址、电话号码等。DataFaker 使用表达式来指定要生成的数据类型,这些表达式由 #{}
包裹。
本手册涵盖了 DataFaker v1.4.0 中可用的表达式,包括其语法和示例。
表达式语法
DataFaker 表达式的基本语法是:
#{category.method}
#{category.method 'param1' 'param2' ...}
例如:
#{name.fullName}
- 生成一个完整的姓名#{internet.email}
- 生成一个电子邮件地址#{date.birthday '5' '10'}
- 生成一个生日,年龄在5到10岁之间
表达式Provider
以下是按照类名组织的DataFaker表达式提供者和对应的方法。
Address
表达式 | 描述 | 表达式示例 | 示例输出 | 参数说明 |
---|---|---|---|---|
#{address.streetName} | 生成街道名称 | #{address.streetName} | Oak Street | |
#{address.streetAddress} | 生成完整的街道地址 | #{address.streetAddress} | 52781 Balistreri Harbor | |
#{address.secondaryAddress} | 生成二级地址 | #{address.secondaryAddress} | Suite 861 | |
#{address.zipCode} | 生成邮政编码 | #{address.zipCode} | 58517 | |
#{address.zipCodeByState 'state'} | 生成指定州的邮政编码 | #{address.zipCodeByState 'CA'} | 90210 | state: 美国州的两位缩写,如’CA’(加利福尼亚)、‘NY’(纽约)、‘TX’(德克萨斯)等 |
#{address.city} | 生成城市名称 | #{address.city} | East Maryville | |
#{address.cityName} | 生成纯城市名称 | #{address.cityName} | Lincoln | |
#{address.cityPrefix} | 生成城市前缀 | #{address.cityPrefix} | North | |
#{address.citySuffix} | 生成城市后缀 | #{address.citySuffix} | ville | |
#{address.state} | 生成州名 | #{address.state} | California | |
#{address.stateAbbr} | 生成州名缩写 | #{address.stateAbbr} | CA | |
#{address.country} | 生成国家名称 | #{address.country} | United States | |
#{address.countryCode} | 生成国家代码 | #{address.countryCode} | US | |
#{address.latitude} | 生成纬度 | #{address.latitude} | 40.123456 | |
#{address.longitude} | 生成经度 | #{address.longitude} | -74.123456 | |
#{address.timeZone} | 生成时区 | #{address.timeZone} | America/New_York | |
#{address.fullAddress} | 生成完整的地址 | #{address.fullAddress} | 52781 Balistreri Harbor, East Maryville, CA 58517 | |
#{address.buildingNumber} | 生成建筑编号 | #{address.buildingNumber} | 7832 | |
#{address.countyByZipCode 'zipCode'} | 根据邮编生成县名 | #{address.countyByZipCode '90210'} | Los Angeles County | zipCode: 美国邮政编码,如’90210’(比佛利山庄)、‘10001’(纽约)、‘33101’(迈阿密)等 |
#{address.postcode} | 生成邮政编码 | #{address.postcode} | 58517 |
Ancient
表达式 | 描述 | 示例输出 |
---|---|---|
#{ancient.god} | 生成古代神明 | Zeus |
#{ancient.primordial} | 生成原始神 | Chaos |
#{ancient.titan} | 生成泰坦 | Cronus |
#{ancient.hero} | 生成古代英雄 | Hercules |
Animal
表达式 | 描述 | 示例输出 |
---|---|---|
#{animal.name} | 生成动物名称 | Lion |
App
表达式 | 描述 | 示例输出 |
---|---|---|
#{app.name} | 生成应用名称 | Stringtough |
#{app.version} | 生成应用版本 | 1.2.3 |
#{app.author} | 生成应用作者 | John Smith |
Appliance
表达式 | 描述 | 示例输出 |
---|---|---|
#{appliance.brand} | 生成电器品牌 | Samsung |
#{appliance.equipment} | 生成电器设备 | Refrigerator |
AquaTeenHungerForce
表达式 | 描述 | 示例输出 |
---|---|---|
#{aquaTeenHungerForce.character} | 生成《飞天汉堡》角色 | Master Shake |
Artist
表达式 | 描述 | 示例输出 |
---|---|---|
#{artist.name} | 生成艺术家名称 | Pablo Picasso |
Australia
表达式 | 描述 | 示例输出 |
---|---|---|
#{australia.locations} | 生成澳大利亚地点 | Sydney |
#{australia.animals} | 生成澳大利亚动物 | Kangaroo |
Avatar
表达式 | 描述 | 示例输出 |
---|---|---|
#{avatar.characters} | 生成《阿凡达》角色 | Aang |
#{avatar.quotes} | 生成《阿凡达》引言 | Flameo, Hotman! |
Aviation
表达式 | 描述 | 示例输出 |
---|---|---|
#{aviation.aircraft} | 生成飞机类型 | Boeing 747 |
#{aviation.airport} | 生成机场名称 | John F. Kennedy International Airport |
#{aviation.flightNumber} | 生成航班号 | AA1234 |
Aws
表达式 | 描述 | 示例输出 |
---|---|---|
#{aws.region} | 生成AWS区域 | us-east-1 |
#{aws.service} | 生成AWS服务 | S3 |
BackToTheFuture
表达式 | 描述 | 示例输出 |
---|---|---|
#{backToTheFuture.character} | 生成《回到未来》角色 | Marty McFly |
#{backToTheFuture.quote} | 生成《回到未来》名言 | Great Scott! |
Babylon5
表达式 | 描述 | 示例输出 |
---|---|---|
#{babylon5.character} | 生成《巴比伦5号》角色 | John Sheridan |
#{babylon5.quote} | 生成《巴比伦5号》名言 | Who are you? |
Barcode
表达式 | 描述 | 示例输出 |
---|---|---|
#{barcode.ean13} | 生成EAN-13条形码 | 5901234123457 |
#{barcode.ean8} | 生成EAN-8条形码 | 73513537 |
#{barcode.gtin13} | 生成GTIN-13 | 5901234123457 |
#{barcode.gtin8} | 生成GTIN-8 | 73513537 |
#{barcode.isbn} | 生成ISBN | 978-3-16-148410-0 |
#{barcode.type} | 生成条形码类型 | EAN-13 |
Basketball
表达式 | 描述 | 示例输出 |
---|---|---|
#{basketball.teams} | 生成篮球队名称 | Los Angeles Lakers |
#{basketball.players} | 生成篮球运动员 | LeBron James |
#{basketball.coaches} | 生成篮球教练 | Steve Kerr |
#{basketball.positions} | 生成篮球位置 | Point Guard |
Battlefield1
表达式 | 描述 | 示例输出 |
---|---|---|
#{battlefield1.classes} | 生成《战地1》兵种 | Assault |
#{battlefield1.vehicles} | 生成《战地1》载具 | Mark V Tank |
#{battlefield1.weapons} | 生成《战地1》武器 | M1911 |
Beer
表达式 | 描述 | 示例输出 |
---|---|---|
#{beer.name} | 生成啤酒名称 | Guinness |
#{beer.style} | 生成啤酒风格 | Stout |
#{beer.hop} | 生成啤酒花 | Cascade |
#{beer.malt} | 生成麦芽 | Pale Malt |
#{beer.yeast} | 生成酵母 | American Ale |
BloodType
表达式 | 描述 | 示例输出 |
---|---|---|
#{bloodtype.type} | 生成血型 | O+ |
#{bloodtype.rh} | 生成血型RH因子 | + |
BojackHorseman
表达式 | 描述 | 示例输出 |
---|---|---|
#{bojackHorseman.characters} | 生成《马男波杰克》角色 | BoJack Horseman |
#{bojackHorseman.quotes} | 生成《马男波杰克》名言 | It gets easier. But you have to do it every day. |
#{bojackHorseman.tongueUwisters} | 生成《马男波杰克》绕口令 | Princess Carolyn picked a pretty pink princess peony. |
Book
表达式 | 描述 | 示例输出 |
---|---|---|
#{book.title} | 生成书籍标题 | The Great Adventure |
#{book.author} | 生成书籍作者 | Jane Smith |
#{book.publisher} | 生成出版社 | Penguin Books |
#{book.genre} | 生成书籍类型 | Science Fiction |
Bool
表达式 | 描述 | 示例输出 |
---|---|---|
#{bool.bool} | 生成布尔值 | true |
BossaNova
表达式 | 描述 | 示例输出 |
---|---|---|
#{bossaNova.artist} | 生成博萨诺瓦艺术家 | Antonio Carlos Jobim |
#{bossaNova.song} | 生成博萨诺瓦歌曲 | The Girl from Ipanema |
BreakingBad
表达式 | 描述 | 示例输出 |
---|---|---|
#{breakingBad.character} | 生成《绝命毒师》角色 | Walter White |
#{breakingBad.episode} | 生成《绝命毒师》剧集 | Pilot |
#{breakingBad.quote} | 生成《绝命毒师》名言 | I am the one who knocks! |
BrooklynNineNine
表达式 | 描述 | 示例输出 |
---|---|---|
#{brooklynNineNine.characters} | 生成《神烦警探》角色 | Jake Peralta |
#{brooklynNineNine.quotes} | 生成《神烦警探》名言 | Cool, cool, cool, cool, cool. No doubt, no doubt. |
Buffy
表达式 | 描述 | 示例输出 |
---|---|---|
#{buffy.character} | 生成《吸血鬼猎人巴菲》角色 | Buffy Summers |
#{buffy.quote} | 生成《吸血鬼猎人巴菲》台词 | Into every generation a slayer is born… |
#{buffy.celebrity} | 生成《吸血鬼猎人巴菲》名人 | Sarah Michelle Gellar |
#{buffy.big_bad} | 生成《吸血鬼猎人巴菲》大反派 | The Master |
#{buffy.episode} | 生成《吸血鬼猎人巴菲》剧集 | Once More, with Feeling |
Business
表达式 | 描述 | 示例输出 |
---|---|---|
#{business.creditCardNumber} | 生成商业信用卡号码 | 4539571147745071 |
#{business.creditCardExpiry} | 生成商业信用卡到期日 | 12/25 |
#{business.creditCardType} | 生成商业信用卡类型 | Visa |
Camera
表达式 | 描述 | 示例输出 |
---|---|---|
#{camera.brand} | 生成相机品牌 | Canon |
#{camera.model} | 生成相机型号 | EOS 5D Mark IV |
#{camera.feature} | 生成相机功能 | 4K Video |
Cat
表达式 | 描述 | 示例输出 |
---|---|---|
#{cat.name} | 生成猫名 | Whiskers |
#{cat.breed} | 生成猫品种 | Persian |
#{cat.registry} | 生成猫注册组织 | CFA |
ChuckNorris
表达式 | 描述 | 示例输出 |
---|---|---|
#{chuckNorris.fact} | 生成查克·诺里斯事实 | Chuck Norris can divide by zero. |
CNPJ
表达式 | 描述 | 示例输出 |
---|---|---|
#{cnpj.valid} | 生成有效的巴西公司注册号 | 11.222.333/0001-44 |
#{cnpj.formatted} | 生成格式化的巴西公司注册号 | 11.222.333/0001-44 |
Code
表达式 | 描述 | 示例输出 |
---|---|---|
#{code.isbn10} | 生成ISBN-10 | 1-234567-89-X |
#{code.isbn13} | 生成ISBN-13 | 978-1-234567-89-7 |
#{code.ean8} | 生成EAN-8条形码 | 73513537 |
#{code.ean13} | 生成EAN-13条形码 | 7350031234562 |
#{code.gtin8} | 生成GTIN-8 | 73513537 |
#{code.gtin13} | 生成GTIN-13 | 7350031234562 |
Coin
表达式 | 描述 | 示例输出 |
---|---|---|
#{coin.flip} | 生成硬币翻转结果 | Heads |
Color
表达式 | 描述 | 示例输出 |
---|---|---|
#{color.name} | 生成颜色名称 | Red |
#{color.hex} | 生成十六进制颜色代码 | #FF5733 |
#{color.rgb} | 生成RGB颜色值 | rgb(255, 87, 51) |
Commerce
表达式 | 描述 | 表达式示例 | 示例输出 |
---|---|---|---|
#{commerce.product} | 生成产品 | #{commerce.product} | Computer |
#{commerce.productName} | 生成产品名称 | #{commerce.productName} | Ergonomic Steel Computer |
#{commerce.price} | 生成价格 | #{commerce.price} | 59.99 |
#{commerce.price 'min' 'max'} | 生成指定范围内的价格 | #{commerce.price '10' '200'} | 129.99 |
#{commerce.price 'min' 'max' 'symbol'} | 生成带货币符号的价格 | #{commerce.price '10' '200' '¥'} | ¥129.99 |
#{commerce.department} | 生成部门 | #{commerce.department} | Electronics |
#{commerce.material} | 生成材料 | #{commerce.material} | Steel |
#{commerce.color} | 生成商品颜色 | #{commerce.color} | blue |
#{commerce.promotionCode} | 生成促销代码 | #{commerce.promotionCode} | SUMMER2023 |
#{commerce.promotionCode 'prefix'} | 生成带指定前缀的促销代码 | #{commerce.promotionCode 'SAVE'} | SAVE25 |
Company
表达式 | 描述 | 示例输出 |
---|---|---|
#{company.name} | 生成公司名称 | Smith and Sons |
#{company.suffix} | 生成公司后缀 | LLC |
#{company.industry} | 生成行业名称 | Information Technology |
#{company.profession} | 生成职业名称 | Engineer |
#{company.buzzword} | 生成商业流行语 | synergistic |
#{company.catchPhrase} | 生成公司口号 | Adaptive logistical approach |
#{company.bs} | 生成商业术语 | implement innovative solutions |
#{company.logo} | 生成公司logo URL | https://pigment.github.io/fake-logos/logos/medium/color/1.png |
#{company.url} | 生成公司网站 | http://www.smith-sons.com |
Country
表达式 | 描述 | 示例输出 |
---|---|---|
#{country.name} | 生成国家名称 | United States |
#{country.code2} | 生成国家二字代码 | US |
#{country.code3} | 生成国家三字代码 | USA |
#{country.capital} | 生成国家首都 | Washington D.C. |
#{country.flag} | 生成国家旗帜表情 | 🇺🇸 |
#{country.currency} | 生成国家货币 | USD |
CPF
表达式 | 描述 | 示例输出 |
---|---|---|
#{cpf.valid} | 生成有效的巴西个人税号 | 123.456.789-09 |
#{cpf.formatted} | 生成格式化的巴西个人税号 | 123.456.789-09 |
CryptoCoin
表达式 | 描述 | 示例输出 |
---|---|---|
#{cryptoCoin.coin} | 生成加密货币名称 | Bitcoin |
Crypto (Hashing)
表达式 | 描述 | 示例输出 |
---|---|---|
#{hashing.md5} | 生成MD5哈希 | 5f4dcc3b5aa765d61d8327deb882cf99 |
#{hashing.sha1} | 生成SHA-1哈希 | 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 |
#{hashing.sha256} | 生成SHA-256哈希 | 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 |
#{hashing.sha512} | 生成SHA-512哈希 | b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86 |
Currency
表达式 | 描述 | 示例输出 |
---|---|---|
#{currency.code} | 生成货币代码 | USD |
#{currency.name} | 生成货币名称 | US Dollar |
#{currency.symbol} | 生成货币符号 | $ |
DateAndTime
表达式 | 描述 | 表达式示例 | 示例输出 | 参数说明 |
---|---|---|---|---|
#{date.birthday} | 生成18-65岁之间的随机生日 | #{date.birthday} | 1990-01-15 | |
#{date.birthday 'pattern'} | 生成18-65岁之间的随机生日并按指定格式返回 | #{date.birthday 'dd/MM/yyyy'} | 15/01/1990 | pattern: 日期格式模式,如’yyyy-MM-dd’、‘dd/MM/yyyy’、'MM/dd/yyyy HH:mm’等 |
#{date.birthday 'minAge' 'maxAge'} | 生成指定年龄范围内的生日 | #{date.birthday '20' '30'} | 1995-01-15 | minAge: 最小年龄,如’18’ maxAge: 最大年龄,如’65’ |
#{date.birthday 'minAge' 'maxAge' 'pattern'} | 生成指定年龄范围内的生日并按指定格式返回 | #{date.birthday '20' '30' 'dd/MM/yyyy'} | 15/01/1995 | minAge: 最小年龄,如’18’ maxAge: 最大年龄,如’65’ pattern: 日期格式模式 |
#{date.future 'days' 'DAYS'} | 生成指定天数内的未来日期,使用DAYS时间单位 | #{date.future '30' 'DAYS'} | 2023-02-15 | days: 未来天数,如’30’ DAYS: 时间单位,这里指定为天 |
#{date.future 'hours' 'HOURS'} | 生成指定小时数内的未来日期,使用HOURS时间单位 | #{date.future '24' 'HOURS'} | 2023-01-16 12:30:00 | hours: 未来小时数,如’24’ HOURS: 时间单位,这里指定为小时 |
#{date.future 'minutes' 'MINUTES'} | 生成指定分钟数内的未来日期,使用MINUTES时间单位 | #{date.future '60' 'MINUTES'} | 2023-01-15 14:45:30 | minutes: 未来分钟数,如’60’ MINUTES: 时间单位,这里指定为分钟 |
#{date.future 'seconds' 'SECONDS'} | 生成指定秒数内的未来日期,使用SECONDS时间单位 | #{date.future '3600' 'SECONDS'} | 2023-01-15 13:45:45 | seconds: 未来秒数,如’3600’ SECONDS: 时间单位,这里指定为秒 |
#{date.future 'days' 'DAYS' 'pattern'} | 生成指定天数内的未来日期并按指定格式返回 | #{date.future '30' 'DAYS' 'dd/MM/yyyy'} | 15/02/2023 | days: 未来天数 DAYS: 时间单位 pattern: 日期格式模式 |
#{date.future 'maxDays' 'minDays' 'DAYS'} | 生成指定天数范围内的未来日期,使用DAYS时间单位 | #{date.future '60' '30' 'DAYS'} | 2023-03-20 | maxDays: 最大未来天数,如’60’ minDays: 最小未来天数,如’30’ DAYS: 时间单位 |
#{date.future 'maxHours' 'minHours' 'HOURS'} | 生成指定小时范围内的未来日期,使用HOURS时间单位 | #{date.future '48' '24' 'HOURS'} | 2023-01-16 10:30:00 | maxHours: 最大未来小时数 minHours: 最小未来小时数 HOURS: 时间单位 |
#{date.future 'maxDays' 'minDays' 'DAYS' 'pattern'} | 生成指定天数范围内的未来日期并按指定格式返回 | #{date.future '60' '30' 'DAYS' 'dd/MM/yyyy'} | 20/03/2023 | maxDays: 最大未来天数 minDays: 最小未来天数 DAYS: 时间单位 pattern: 日期格式模式 |
#{date.past 'days' 'DAYS'} | 生成指定天数内的过去日期,使用DAYS时间单位 | #{date.past '30' 'DAYS'} | 2022-12-15 | days: 过去天数,如’30’ DAYS: 时间单位 |
#{date.past 'hours' 'HOURS'} | 生成指定小时数内的过去日期,使用HOURS时间单位 | #{date.past '24' 'HOURS'} | 2023-01-15 08:30:00 | hours: 过去小时数 HOURS: 时间单位 |
#{date.past 'minutes' 'MINUTES'} | 生成指定分钟数内的过去日期,使用MINUTES时间单位 | #{date.past '60' 'MINUTES'} | 2023-01-15 13:00:30 | minutes: 过去分钟数 MINUTES: 时间单位 |
#{date.past 'seconds' 'SECONDS'} | 生成指定秒数内的过去日期,使用SECONDS时间单位 | #{date.past '3600' 'SECONDS'} | 2023-01-15 13:44:30 | seconds: 过去秒数 SECONDS: 时间单位 |
#{date.past 'days' 'DAYS' 'pattern'} | 生成指定天数内的过去日期并按指定格式返回 | #{date.past '30' 'DAYS' 'dd/MM/yyyy'} | 15/12/2022 | days: 过去天数 DAYS: 时间单位 pattern: 日期格式模式 |
#{date.past 'maxDays' 'minDays' 'DAYS'} | 生成指定天数范围内的过去日期,使用DAYS时间单位 | #{date.past '60' '30' 'DAYS'} | 2022-11-20 | maxDays: 最大过去天数 minDays: 最小过去天数 DAYS: 时间单位 |
#{date.past 'maxHours' 'minHours' 'HOURS'} | 生成指定小时范围内的过去日期,使用HOURS时间单位 | #{date.past '48' '24' 'HOURS'} | 2023-01-15 08:30:00 | maxHours: 最大过去小时数 minHours: 最小过去小时数 HOURS: 时间单位 |
#{date.past 'maxDays' 'minDays' 'DAYS' 'pattern'} | 生成指定天数范围内的过去日期并按指定格式返回 | #{date.past '60' '30' 'DAYS' 'dd/MM/yyyy'} | 20/11/2022 | maxDays: 最大过去天数 minDays: 最小过去天数 DAYS: 时间单位 pattern: 日期格式模式 |
#{date.between 'startDate' 'endDate'} | 生成指定日期范围内的日期 | #{date.between '2022-01-01' '2022-12-31'} | 2022-06-15 | startDate: 起始日期,格式如’2022-01-01’ endDate: 结束日期,格式如’2022-12-31’ |
#{date.between 'startDate' 'endDate' 'pattern'} | 生成指定日期范围内的日期并按指定格式返回 | #{date.between '2022-01-01' '2022-12-31' 'dd/MM/yyyy'} | 15/06/2022 | startDate: 起始日期 endDate: 结束日期 pattern: 日期格式模式 |
#{date.betweenTimestamps 'timestamp1' 'timestamp2'} | 生成指定时间戳范围内的日期 | #{date.betweenTimestamps '1640995200000' '1672531199000'} | 2022-06-15 | timestamp1: 起始时间戳(毫秒) timestamp2: 结束时间戳(毫秒) |
#{date.month} | 生成月份名称 | #{date.month} | January | |
#{date.monthNumber} | 生成月份数字 | #{date.monthNumber} | 01 | |
#{date.weekday} | 生成星期几 | #{date.weekday} | Monday | |
#{date.time} | 生成时间 | #{date.time} | 13:45:30 | |
#{date.now} | 生成当前日期时间 | #{date.now} | 2023-01-15T13:45:30 | |
#{date.duration 'max' 'DAYS'} | 生成最大天数的随机持续时间 | #{date.duration '5' 'DAYS'} | P3D (3天) | max: 最大天数 DAYS: 时间单位,可选值包括DAYS, HOURS, MINUTES, SECONDS, NANOS等 |
#{date.duration 'max' 'HOURS'} | 生成最大小时数的随机持续时间 | #{date.duration '12' 'HOURS'} | PT10H (10小时) | max: 最大小时数 HOURS: 时间单位 |
#{date.duration 'max' 'MINUTES'} | 生成最大分钟数的随机持续时间 | #{date.duration '60' 'MINUTES'} | PT45M (45分钟) | max: 最大分钟数 MINUTES: 时间单位 |
#{date.duration 'max' 'SECONDS'} | 生成最大秒数的随机持续时间 | #{date.duration '60' 'SECONDS'} | PT30S (30秒) | max: 最大秒数 SECONDS: 时间单位 |
#{date.duration 'min' 'max' 'DAYS'} | 生成指定天数范围的随机持续时间 | #{date.duration '1' '5' 'DAYS'} | P2D (2天) | min: 最小天数 max: 最大天数 DAYS: 时间单位 |
#{date.duration 'min' 'max' 'HOURS'} | 生成指定小时范围的随机持续时间 | #{date.duration '1' '10' 'HOURS'} | PT5H (5小时) | min: 最小小时数 max: 最大小时数 HOURS: 时间单位 |
#{date.duration 'min' 'max' 'MINUTES'} | 生成指定分钟范围的随机持续时间 | #{date.duration '15' '45' 'MINUTES'} | PT30M (30分钟) | min: 最小分钟数 max: 最大分钟数 MINUTES: 时间单位 |
#{date.duration 'min' 'max' 'SECONDS'} | 生成指定秒数范围的随机持续时间 | #{date.duration '5' '30' 'SECONDS'} | PT15S (15秒) | min: 最小秒数 max: 最大秒数 SECONDS: 时间单位 |
Demographic
表达式 | 描述 | 示例输出 |
---|---|---|
#{demographic.race} | 生成种族 | Caucasian |
#{demographic.sex} | 生成性别 | Male |
#{demographic.demonym} | 生成民族名称 | American |
#{demographic.maritalStatus} | 生成婚姻状态 | Single |
#{demographic.educationalAttainment} | 生成教育程度 | Bachelor’s Degree |
Dessert
表达式 | 描述 | 示例输出 |
---|---|---|
#{dessert.variety} | 生成甜点种类 | Cheesecake |
#{dessert.topping} | 生成甜点配料 | Whipped Cream |
#{dessert.flavor} | 生成甜点口味 | Chocolate |
Device
表达式 | 描述 | 示例输出 |
---|---|---|
#{device.manufacturer} | 生成设备制造商 | Apple |
#{device.modelName} | 生成设备型号名称 | iPhone 13 Pro |
#{device.platform} | 生成设备平台 | iOS |
#{device.serial} | 生成设备序列号 | ABC123456789 |
Disease
表达式 | 描述 | 示例输出 |
---|---|---|
#{disease.internalDisease} | 生成内科疾病 | Pneumonia |
#{disease.neurologicalDisease} | 生成神经系统疾病 | Migraine |
#{disease.psychiatricDisorder} | 生成精神疾病 | Depression |
Dog
表达式 | 描述 | 示例输出 |
---|---|---|
#{dog.name} | 生成狗名 | Max |
#{dog.breed} | 生成狗品种 | Golden Retriever |
#{dog.sound} | 生成狗叫声 | Woof |
#{dog.memePhrase} | 生成狗表情包短语 | Much wow |
#{dog.age} | 生成狗年龄 | 3 years |
#{dog.coatLength} | 生成狗毛长度 | Short |
#{dog.size} | 生成狗体型 | Medium |
#{dog.gender} | 生成狗性别 | Male |
Domain
表达式 | 描述 | 示例输出 |
---|---|---|
#{domain.name} | 生成域名 | example.com |
#{domain.word} | 生成域名单词 | example |
#{domain.suffix} | 生成域名后缀 | com |
DragonBall
表达式 | 描述 | 示例输出 |
---|---|---|
#{dragonBall.character} | 生成《龙珠》角色 | Goku |
#{dragonBall.planet} | 生成《龙珠》星球 | Earth |
Dune
表达式 | 描述 | 示例输出 |
---|---|---|
#{dune.character} | 生成《沙丘》角色 | Paul Atreides |
#{dune.planet} | 生成《沙丘》星球 | Arrakis |
#{dune.quote} | 生成《沙丘》名言 | Fear is the mind-killer. |
Educator
表达式 | 描述 | 示例输出 |
---|---|---|
#{educator.university} | 生成大学名称 | Stanford University |
#{educator.course} | 生成课程名称 | Computer Science 101 |
#{educator.campus} | 生成校区 | Main Campus |
#{educator.secondarySchool} | 生成中学 | Washington High School |
EldenRing
表达式 | 描述 | 示例输出 |
---|---|---|
#{eldenRing.character} | 生成《艾尔登法环》角色 | Malenia |
#{eldenRing.location} | 生成《艾尔登法环》地点 | Limgrave |
#{eldenRing.npc} | 生成《艾尔登法环》NPC | Melina |
ElderScrolls
表达式 | 描述 | 示例输出 |
---|---|---|
#{elderScrolls.race} | 生成《上古卷轴》种族 | Nord |
#{elderScrolls.creature} | 生成《上古卷轴》生物 | Draugr |
#{elderScrolls.city} | 生成《上古卷轴》城市 | Whiterun |
#{elderScrolls.region} | 生成《上古卷轴》地区 | Skyrim |
#{elderScrolls.dragon} | 生成《上古卷轴》龙 | Alduin |
#{elderScrolls.firstName} | 生成《上古卷轴》名字 | Balgruuf |
#{elderScrolls.lastName} | 生成《上古卷轴》姓氏 | Gray-Mane |
EnglandFootBall
表达式 | 描述 | 示例输出 |
---|---|---|
#{englandfootball.team} | 生成英格兰足球队 | Manchester United |
#{englandfootball.player} | 生成英格兰足球运动员 | Harry Kane |
ElectricalComponents
表达式 | 描述 | 示例输出 |
---|---|---|
#{electricalComponents.active} | 生成有源电子元件 | Transistor |
#{electricalComponents.passive} | 生成无源电子元件 | Resistor |
#{electricalComponents.electromechanical} | 生成机电元件 | Relay |
Esports
表达式 | 描述 | 示例输出 |
---|---|---|
#{esports.player} | 生成电竞选手 | Faker |
#{esports.team} | 生成电竞团队 | T1 |
#{esports.event} | 生成电竞赛事 | League of Legends World Championship |
#{esports.league} | 生成电竞联赛 | LCK |
#{esports.game} | 生成电竞游戏 | League of Legends |
FakeDuration
表达式 | 描述 | 示例输出 |
---|---|---|
#{duration.shortTime} | 生成短时间持续时间 | 30 seconds |
#{duration.mediumTime} | 生成中等时间持续时间 | 15 minutes |
#{duration.longTime} | 生成长时间持续时间 | 3 hours |
File
表达式 | 描述 | 表达式示例 | 示例输出 |
---|---|---|---|
#{file.fileName} | 生成随机文件名 | #{file.fileName} | document.pdf |
#{file.fileName 'extension'} | 生成指定扩展名的随机文件名 | #{file.fileName 'xlsx'} | report.xlsx |
#{file.extension} | 生成随机文件扩展名 | #{file.extension} | |
#{file.mimeType} | 生成随机MIME类型 | #{file.mimeType} | application/pdf |
#{file.directoryPath} | 生成随机目录路径 | #{file.directoryPath} | /usr/local/bin |
Finance
表达式 | 描述 | 表达式示例 | 示例输出 | 参数说明 |
---|---|---|---|---|
#{finance.creditCard} | 生成信用卡号 | #{finance.creditCard} | 4532-1234-5678-9012 | |
#{finance.creditCardNumber} | 生成不带分隔符的信用卡号 | #{finance.creditCardNumber} | 4532123456789012 | |
#{finance.creditCardType} | 生成信用卡类型 | #{finance.creditCardType} | VISA | |
#{finance.creditCardExpiry} | 生成信用卡到期日 | #{finance.creditCardExpiry} | 07/25 | |
#{finance.iban} | 生成IBAN账号 | #{finance.iban} | GB82WEST12345698765432 | |
#{finance.iban 'countryCode'} | 生成指定国家的IBAN账号 | #{finance.iban 'FR'} | FR14BARC20035835478974 | countryCode: 两位ISO国家代码,如 ‘GB’(英国)、‘FR’(法国)、‘DE’(德国)、‘IT’(意大利)等 |
#{finance.bic} | 生成BIC代码 | #{finance.bic} | MIDLGB22 | |
#{finance.bitcoinAddress} | 生成比特币地址 | #{finance.bitcoinAddress} | 1MdwEgJE4v5ZHT9uqFGxAqKKoNE9pdMZHz |
Food
表达式 | 描述 | 示例输出 |
---|---|---|
#{food.ingredient} | 生成食材 | Chicken |
#{food.spice} | 生成香料 | Pepper |
#{food.dish} | 生成菜肴 | Pasta Carbonara |
#{food.measurement} | 生成食物计量单位 | Cup |
#{food.measurementSize} | 生成食物计量大小 | 1/2 |
#{food.fruit} | 生成水果 | Apple |
#{food.vegetable} | 生成蔬菜 | Carrot |
Formula1
表达式 | 描述 | 示例输出 |
---|---|---|
#{formula1.driver} | 生成F1车手 | Lewis Hamilton |
#{formula1.team} | 生成F1车队 | Mercedes |
#{formula1.circuit} | 生成F1赛道 | Circuit de Monaco |
#{formula1.grandPrix} | 生成F1大奖赛 | British Grand Prix |
Friends
表达式 | 描述 | 示例输出 |
---|---|---|
#{friends.character} | 生成《老友记》角色 | Ross Geller |
#{friends.location} | 生成《老友记》地点 | Central Perk |
#{friends.quote} | 生成《老友记》台词 | How you doin’? |
FunnyName
表达式 | 描述 | 示例输出 |
---|---|---|
#{funnyName.name} | 生成有趣的名字 | Cheeseburger Brown |
GameOfThrones
表达式 | 描述 | 示例输出 |
---|---|---|
#{gameOfThrones.character} | 生成《权力的游戏》角色 | Jon Snow |
#{gameOfThrones.house} | 生成《权力的游戏》家族 | Stark |
#{gameOfThrones.city} | 生成《权力的游戏》城市 | King’s Landing |
#{gameOfThrones.quote} | 生成《权力的游戏》名言 | Winter is coming |
#{gameOfThrones.dragon} | 生成《权力的游戏》龙 | Drogon |
Gender
表达式 | 描述 | 示例输出 |
---|---|---|
#{gender.types} | 生成性别类型 | Male |
#{gender.binaryTypes} | 生成二元性别类型 | Female |
GratefulDead
表达式 | 描述 | 示例输出 |
---|---|---|
#{gratefulDead.player} | 生成《感恩而死》乐队成员 | Jerry Garcia |
#{gratefulDead.song} | 生成《感恩而死》歌曲 | Touch of Grey |
Hacker
表达式 | 描述 | 示例输出 |
---|---|---|
#{hacker.abbreviation} | 生成黑客术语缩写 | HTTP |
#{hacker.adjective} | 生成黑客形容词 | auxiliary |
#{hacker.noun} | 生成黑客名词 | system |
#{hacker.verb} | 生成黑客动词 | hack |
#{hacker.ingverb} | 生成黑客ing动词 | backing up |
#{hacker.phrase} | 生成黑客短语 | Try to override the TCP bus, maybe it will program the digital microchip! |
HarryPotter
表达式 | 描述 | 示例输出 |
---|---|---|
#{harryPotter.character} | 生成《哈利波特》角色 | Harry Potter |
#{harryPotter.location} | 生成《哈利波特》地点 | Hogwarts |
#{harryPotter.spell} | 生成《哈利波特》咒语 | Expecto Patronum |
#{harryPotter.house} | 生成《哈利波特》学院 | Gryffindor |
#{harryPotter.book} | 生成《哈利波特》书籍 | Harry Potter and the Philosopher’s Stone |
Hearthstone
表达式 | 描述 | 示例输出 |
---|---|---|
#{hearthstone.card} | 生成《炉石传说》卡牌 | Tirion Fordring |
#{hearthstone.class} | 生成《炉石传说》职业 | Mage |
#{hearthstone.minion} | 生成《炉石传说》随从 | Leeroy Jenkins |
HeyArnold
表达式 | 描述 | 示例输出 |
---|---|---|
#{heyArnold.character} | 生成《嘿,阿诺德!》角色 | Arnold |
#{heyArnold.location} | 生成《嘿,阿诺德!》地点 | P.S. 118 |
#{heyArnold.quote} | 生成《嘿,阿诺德!》名言 | Move it, Football Head! |
Hipster
表达式 | 描述 | 示例输出 |
---|---|---|
#{hipster.word} | 生成文青词汇 | vinyl |
#{hipster.words} | 生成文青词汇组 | vinyl mixtape kale |
#{hipster.sentence} | 生成文青句子 | Tote bag tousled DIY, banjo actually letterpress thundercats gluten-free. |
#{hipster.paragraph} | 生成文青段落 | Tote bag tousled DIY, banjo actually letterpress thundercats gluten-free… |
HitchhikersGuideToTheGalaxy
表达式 | 描述 | 示例输出 |
---|---|---|
#{hitchhikersGuideToTheGalaxy.character} | 生成《银河系漫游指南》角色 | Arthur Dent |
#{hitchhikersGuideToTheGalaxy.planet} | 生成《银河系漫游指南》行星 | Magrathea |
#{hitchhikersGuideToTheGalaxy.location} | 生成《银河系漫游指南》地点 | Milliways |
#{hitchhikersGuideToTheGalaxy.marvin} | 生成《银河系漫游指南》机器人马文语录 | Life? Don’t talk to me about life. |
#{hitchhikersGuideToTheGalaxy.quote} | 生成《银河系漫游指南》名言 | Don’t Panic! |
Hobbit
表达式 | 描述 | 示例输出 |
---|---|---|
#{hobbit.character} | 生成《霍比特人》角色 | Bilbo Baggins |
#{hobbit.location} | 生成《霍比特人》地点 | The Shire |
#{hobbit.quote} | 生成《霍比特人》名言 | Not all those who wander are lost. |
#{hobbit.thorinsCompany} | 生成《霍比特人》索林的队伍成员 | Fili |
Hobby
表达式 | 描述 | 示例输出 |
---|---|---|
#{hobby.activity} | 生成业余活动 | Reading |
Horse
表达式 | 描述 | 示例输出 |
---|---|---|
#{horse.name} | 生成马名 | Thunder |
#{horse.breed} | 生成马品种 | Arabian |
HowIMetYourMother
表达式 | 描述 | 示例输出 |
---|---|---|
#{howIMetYourMother.character} | 生成《老爸老妈浪漫史》角色 | Barney Stinson |
#{howIMetYourMother.catchPhrase} | 生成《老爸老妈浪漫史》口头禅 | Legen… wait for it… dary! |
#{howIMetYourMother.highFive} | 生成《老爸老妈浪漫史》击掌 | Relapse Five |
#{howIMetYourMother.quote} | 生成《老爸老妈浪漫史》台词 | Challenge accepted! |
IdNumber
表达式 | 描述 | 示例输出 |
---|---|---|
#{idNumber.valid} | 生成有效的ID号码 | 123-45-6789 |
#{idNumber.invalid} | 生成无效的ID号码 | 123-45-0000 |
#{idNumber.ssnValid} | 生成有效的社会安全号码 | 123-45-6789 |
#{idNumber.validSvSeSsn} | 生成有效的瑞典社会安全号码 | 19901230-1234 |
#{idNumber.invalidSvSeSsn} | 生成无效的瑞典社会安全号码 | 19901230-0000 |
Internet
表达式 | 描述 | 表达式示例 | 示例输出 |
---|---|---|---|
#{internet.email} | 生成电子邮件地址 | #{internet.email} | john.smith@example.com |
#{internet.emailAddress 'firstName' 'lastName' 'domainName'} | 生成指定参数的电子邮件地址 | #{internet.emailAddress 'jane' 'doe' 'company.com'} | jane.doe@company.com |
#{internet.safeEmail} | 生成安全域名的电子邮件 | #{internet.safeEmail} | john.smith@example.org |
#{internet.domainName} | 生成域名 | #{internet.domainName} | example.com |
#{internet.domainWord} | 生成域名前缀 | #{internet.domainWord} | example |
#{internet.domainSuffix} | 生成域名后缀 | #{internet.domainSuffix} | com |
#{internet.url} | 生成URL | #{internet.url} | http://www.example.com |
#{internet.avatar} | 生成头像URL | #{internet.avatar} | https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1.jpg |
#{internet.image} | 生成图片URL | #{internet.image} | https://picsum.photos/640/480 |
#{internet.password 'minLength' 'maxLength'} | 生成密码 | #{internet.password '8' '12'} | a6y9dx0f3z |
#{internet.macAddress} | 生成MAC地址 | #{internet.macAddress} | 00:1B:63:84:45:E6 |
#{internet.ipV4Address} | 生成IPv4地址 | #{internet.ipV4Address} | 192.168.1.1 |
#{internet.ipV4Cidr} | 生成IPv4 CIDR | #{internet.ipV4Cidr} | 192.168.1.0/24 |
#{internet.ipV6Address} | 生成IPv6地址 | #{internet.ipV6Address} | 2001:0db8:85a3:0000:0000:8a2e:0370:7334 |
#{internet.ipV6Cidr} | 生成IPv6 CIDR | #{internet.ipV6Cidr} | 2001:0db8:85a3:0000:0000:8a2e:0370:7334/64 |
#{internet.userAgent} | 生成用户代理字符串 | #{internet.userAgent} | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36 |
#{internet.slug} | 生成URL slug | #{internet.slug} | lorem-ipsum-dolor |
#{internet.uuid} | 生成UUID | #{internet.uuid} | 123e4567-e89b-12d3-a456-426614174000 |
#{internet.httpMethod} | 生成HTTP方法 | #{internet.httpMethod} | GET |
#{internet.httpStatusCode} | 生成HTTP状态码 | #{internet.httpStatusCode} | 200 |
Job
表达式 | 描述 | 示例输出 |
---|---|---|
#{job.title} | 生成工作职称 | Software Engineer |
#{job.field} | 生成工作领域 | Information Technology |
#{job.seniority} | 生成职位级别 | Senior |
#{job.position} | 生成工作职位 | Developer |
#{job.keySkills} | 生成关键技能 | Programming, Communication |
Kaamelott
表达式 | 描述 | 示例输出 |
---|---|---|
#{kaamelott.character} | 生成《卡默洛特》角色 | Arthur |
#{kaamelott.quote} | 生成《卡默洛特》名言 | C’est pas faux. |
Kpop
表达式 | 描述 | 示例输出 |
---|---|---|
#{kpop.girlgroups} | 生成K-pop女团 | BLACKPINK |
#{kpop.boygroups} | 生成K-pop男团 | BTS |
#{kpop.solo} | 生成K-pop独唱艺人 | Psy |
Lebowski
表达式 | 描述 | 示例输出 |
---|---|---|
#{lebowski.character} | 生成《大勒布斯基》角色 | The Dude |
#{lebowski.quote} | 生成《大勒布斯基》名言 | The Dude abides. |
#{lebowski.actor} | 生成《大勒布斯基》演员 | Jeff Bridges |
LeagueOfLegends
表达式 | 描述 | 示例输出 |
---|---|---|
#{leagueOfLegends.champion} | 生成《英雄联盟》英雄 | Garen |
#{leagueOfLegends.location} | 生成《英雄联盟》地点 | Demacia |
#{leagueOfLegends.quote} | 生成《英雄联盟》台词 | For Demacia! |
#{leagueOfLegends.summonerSpell} | 生成《英雄联盟》召唤师技能 | Flash |
#{leagueOfLegends.masteries} | 生成《英雄联盟》天赋 | Fervor of Battle |
#{leagueOfLegends.rank} | 生成《英雄联盟》等级 | Platinum |
LordOfTheRings
表达式 | 描述 | 示例输出 |
---|---|---|
#{lordOfTheRings.character} | 生成《指环王》角色 | Frodo Baggins |
#{lordOfTheRings.location} | 生成《指环王》地点 | The Shire |
#{lordOfTheRings.race} | 生成《指环王》种族 | Hobbit |
Lorem
表达式 | 描述 | 表达式示例 | 示例输出 |
---|---|---|---|
#{lorem.word} | 生成一个随机单词 | #{lorem.word} | lorem |
#{lorem.words 'count'} | 生成指定数量的随机单词 | #{lorem.words '3'} | lorem ipsum dolor |
#{lorem.sentence} | 生成一个随机句子 | #{lorem.sentence} | Lorem ipsum dolor sit amet. |
#{lorem.sentence 'wordCount'} | 生成包含指定单词数的随机句子 | #{lorem.sentence '6'} | Lorem ipsum dolor sit amet consectetur. |
#{lorem.sentences 'count'} | 生成指定数量的随机句子 | #{lorem.sentences '2'} | Lorem ipsum dolor sit amet. Consectetur adipiscing elit. |
#{lorem.paragraph} | 生成一个随机段落 | #{lorem.paragraph} | Lorem ipsum dolor sit amet… |
#{lorem.paragraph 'sentenceCount'} | 生成包含指定句子数的随机段落 | #{lorem.paragraph '3'} | Lorem ipsum dolor sit amet… |
#{lorem.paragraphs 'count'} | 生成指定数量的随机段落 | #{lorem.paragraphs '2'} | Lorem ipsum dolor sit amet… Consectetur adipiscing elit… |
Marketing
表达式 | 描述 | 示例输出 |
---|---|---|
#{marketing.buzzwords} | 生成营销流行语 | synergistic |
#{marketing.promotionalCode} | 生成促销代码 | SAVE25 |
Matz
表达式 | 描述 | 示例输出 |
---|---|---|
#{matz.quote} | 生成松本行弘语录 | Ruby is designed to make programmers happy. |
Medical
表达式 | 描述 | 示例输出 |
---|---|---|
#{medical.medicineName} | 生成药品名称 | Ibuprofen |
#{medical.diseaseName} | 生成疾病名称 | Influenza |
#{medical.hospitalName} | 生成医院名称 | General Hospital |
#{medical.symptoms} | 生成症状 | Fever |
#{medical.diagnosis} | 生成诊断 | Acute Bronchitis |
Military
表达式 | 描述 | 示例输出 |
---|---|---|
#{military.armyRank} | 生成陆军军衔 | Captain |
#{military.navyRank} | 生成海军军衔 | Lieutenant |
#{military.airForceRank} | 生成空军军衔 | Colonel |
#{military.marinesRank} | 生成海军陆战队军衔 | Sergeant |
Minecraft
表达式 | 描述 | 示例输出 |
---|---|---|
#{minecraft.block} | 生成《我的世界》方块 | Stone |
#{minecraft.biome} | 生成《我的世界》生物群系 | Desert |
#{minecraft.tool} | 生成《我的世界》工具 | Diamond Pickaxe |
#{minecraft.mob} | 生成《我的世界》生物 | Creeper |
#{minecraft.item} | 生成《我的世界》物品 | Iron Ingot |
#{minecraft.achievement} | 生成《我的世界》成就 | Getting Wood |
Mood
表达式 | 描述 | 示例输出 |
---|---|---|
#{mood.emotion} | 生成情绪描述 | Happy |
#{mood.feeling} | 生成感觉描述 | Content |
#{mood.tone} | 生成语气描述 | Cheerful |
Mountain
表达式 | 描述 | 示例输出 |
---|---|---|
#{mountain.name} | 生成山脉名称 | Mount Everest |
#{mountain.range} | 生成山脉系列 | Himalayas |
Mountaineering
表达式 | 描述 | 示例输出 |
---|---|---|
#{mountaineering.mountaineer} | 生成登山者 | Edmund Hillary |
#{mountaineering.gear} | 生成登山装备 | Crampons |
Music
表达式 | 描述 | 示例输出 |
---|---|---|
#{music.genre} | 生成音乐类型 | Rock |
#{music.instrument} | 生成乐器 | Guitar |
#{music.key} | 生成音乐调式 | C Major |
#{music.chord} | 生成和弦 | C Major |
#{music.artist} | 生成音乐艺术家 | The Beatles |
Name
表达式 | 描述 | 表达式示例 | 示例输出 |
---|---|---|---|
#{name.fullName} | 生成完整姓名 | #{name.fullName} | John Smith |
#{name.firstName} | 生成名字 | #{name.firstName} | John |
#{name.lastName} | 生成姓氏 | #{name.lastName} | Smith |
#{name.prefix} | 生成名字前缀 | #{name.prefix} | Dr. |
#{name.suffix} | 生成名字后缀 | #{name.suffix} | Jr. |
#{name.title} | 生成职称 | #{name.title} | Lead Solutions Engineer |
#{name.username} | 生成用户名 | #{name.username} | john.smith |
#{name.nameWithMiddle} | 生成带中间名的姓名 | #{name.nameWithMiddle} | John A. Smith |
#{name.bloodGroup} | 生成血型 | #{name.bloodGroup} | AB+ |
#{name.femaleFirstName} | 生成女性名字 | #{name.femaleFirstName} | Mary |
#{name.maleFirstName} | 生成男性名字 | #{name.maleFirstName} | John |
Nation
表达式 | 描述 | 示例输出 |
---|---|---|
#{nation.nationality} | 生成国籍 | American |
#{nation.language} | 生成语言 | English |
#{nation.capitalCity} | 生成首都 | Washington D.C. |
#{nation.flag} | 生成国旗表情 | 🇺🇸 |
NatoPhoneticAlphabet
表达式 | 描述 | 示例输出 |
---|---|---|
#{natoPhoneticAlphabet.codeWord} | 生成北约音标字母代码词 | Alpha |
Nigeria
表达式 | 描述 | 示例输出 |
---|---|---|
#{nigeria.name} | 生成尼日利亚人名 | Adebayo |
#{nigeria.state} | 生成尼日利亚州名 | Lagos |
Number
表达式 | 描述 | 表达式示例 | 示例输出 |
---|---|---|---|
#{number.randomDigit} | 生成0-9的随机数字 | #{number.randomDigit} | 7 |
#{number.randomDigitNotZero} | 生成1-9的随机数字 | #{number.randomDigitNotZero} | 8 |
#{number.numberBetween 'min' 'max'} | 生成指定范围内的随机数 | #{number.numberBetween '1' '100'} | 42 |
#{number.randomDouble 'maxNumberOfDecimals' 'min' 'max'} | 生成指定范围内的随机双精度数 | #{number.randomDouble '2' '0' '100'} | 42.75 |
#{number.randomNumber} | 生成随机数 | #{number.randomNumber} | 54321 |
#{number.randomNumber 'digits'} | 生成指定位数的随机数 | #{number.randomNumber '5'} | 12345 |
#{number.digit} | 生成单个数字 | #{number.digit} | 7 |
Options
表达式 | 描述 | 示例输出 |
---|---|---|
#{options.option 'option1' 'option2' 'option3'} | 从给定选项中选择一个 | option2 |
Overwatch
表达式 | 描述 | 示例输出 |
---|---|---|
#{overwatch.hero} | 生成《守望先锋》英雄 | Tracer |
#{overwatch.location} | 生成《守望先锋》地点 | King’s Row |
#{overwatch.quote} | 生成《守望先锋》台词 | Cheers, love! The cavalry’s here! |
OscarMovie
表达式 | 描述 | 示例输出 |
---|---|---|
#{oscarMovie.actor} | 生成奥斯卡获奖演员 | Leonardo DiCaprio |
#{oscarMovie.actress} | 生成奥斯卡获奖女演员 | Meryl Streep |
#{oscarMovie.film} | 生成奥斯卡获奖电影 | The Godfather |
Passport
表达式 | 描述 | 示例输出 |
---|---|---|
#{passport.number} | 生成护照号码 | 123456789 |
PhoneNumber
表达式 | 描述 | 示例输出 |
---|---|---|
#{phoneNumber.phoneNumber} | 生成电话号码 | (555) 123-4567 |
#{phoneNumber.cellPhone} | 生成手机号码 | (555) 987-6543 |
#{phoneNumber.subscriberNumber 'length'} | 生成指定长度的电话号码 | 12345678 |
Photography
表达式 | 描述 | 示例输出 |
---|---|---|
#{photography.aperture} | 生成相机光圈值 | f/2.8 |
#{photography.shutterSpeed} | 生成相机快门速度 | 1/125 |
#{photography.iso} | 生成相机ISO值 | 400 |
#{photography.cameraManufacturer} | 生成相机制造商 | Canon |
Pokemon
表达式 | 描述 | 示例输出 |
---|---|---|
#{pokemon.name} | 生成宝可梦名称 | Pikachu |
#{pokemon.location} | 生成宝可梦地点 | Kanto |
#{pokemon.type} | 生成宝可梦属性 | Electric |
PrincessBride
表达式 | 描述 | 示例输出 |
---|---|---|
#{princessBride.character} | 生成《公主新娘》角色 | Westley |
#{princessBride.quote} | 生成《公主新娘》名言 | As you wish. |
ProgrammingLanguage
表达式 | 描述 | 示例输出 |
---|---|---|
#{programmingLanguage.name} | 生成编程语言名称 | Java |
#{programmingLanguage.creator} | 生成编程语言创建者 | James Gosling |
Relationship
表达式 | 描述 | 示例输出 |
---|---|---|
#{relationships.status} | 生成关系状态 | Dating |
#{relationships.term} | 生成关系称谓 | Boyfriend |
ResidentEvil
表达式 | 描述 | 示例输出 |
---|---|---|
#{residentEvil.character} | 生成《生化危机》角色 | Leon S. Kennedy |
#{residentEvil.creature} | 生成《生化危机》生物 | Zombie |
#{residentEvil.location} | 生成《生化危机》地点 | Raccoon City |
Restaurant
表达式 | 描述 | 示例输出 |
---|---|---|
#{restaurant.name} | 生成餐厅名称 | The Rusty Spoon |
#{restaurant.type} | 生成餐厅类型 | Italian |
#{restaurant.review} | 生成餐厅评价 | The atmosphere was great but the service was slow |
RickAndMorty
表达式 | 描述 | 示例输出 |
---|---|---|
#{rickAndMorty.character} | 生成《瑞克和莫蒂》角色 | Rick Sanchez |
#{rickAndMorty.location} | 生成《瑞克和莫蒂》位置 | Citadel of Ricks |
#{rickAndMorty.quote} | 生成《瑞克和莫蒂》名言 | Wubba Lubba Dub Dub! |
Robin
表达式 | 描述 | 示例输出 |
---|---|---|
#{robin.quote} | 生成罗宾名言 | Holy strawberries Batman! |
RockBand
表达式 | 描述 | 示例输出 |
---|---|---|
#{rockBand.name} | 生成摇滚乐队名称 | The Rolling Stones |
RuPaulDragRace
表达式 | 描述 | 示例输出 |
---|---|---|
#{ruPaulDragRace.queen} | 生成《鲁保罗变装皇后秀》皇后 | RuPaul |
#{ruPaulDragRace.quote} | 生成《鲁保罗变装皇后秀》名言 | If you can’t love yourself, how in the hell you gonna love somebody else? |
Science
表达式 | 描述 | 示例输出 |
---|---|---|
#{science.element} | 生成化学元素 | Hydrogen |
#{science.unit} | 生成科学单位 | Newton |
#{science.scientist} | 生成科学家 | Albert Einstein |
#{science.tool} | 生成科学工具 | Microscope |
#{science.quark} | 生成夸克 | Up |
#{science.leptons} | 生成轻子 | Electron |
#{science.boson} | 生成玻色子 | Photon |
Seinfeld
表达式 | 描述 | 示例输出 |
---|---|---|
#{seinfeld.character} | 生成《宋飞正传》角色 | Jerry Seinfeld |
#{seinfeld.quote} | 生成《宋飞正传》台词 | These pretzels are making me thirsty! |
#{seinfeld.business} | 生成《宋飞正传》商业 | Vandelay Industries |
SlackEmoji
表达式 | 描述 | 示例输出 |
---|---|---|
#{slackEmoji.emoji} | 生成Slack表情符号 | 😄 |
#{slackEmoji.people} | 生成Slack人物表情 | 😉 |
#{slackEmoji.nature} | 生成Slack自然表情 | :fox: |
#{slackEmoji.food} | 生成Slack食物表情 | 🍕 |
Shakespeare
表达式 | 描述 | 示例输出 |
---|---|---|
#{shakespeare.hamlet} | 生成《哈姆雷特》的随机引用 | To be, or not to be… |
#{shakespeare.asYouLikeIt} | 生成《皆大欢喜》的随机引用 | All the world’s a stage… |
#{shakespeare.kingRichard} | 生成《理查德三世》的随机引用 | Now is the winter of our discontent… |
#{shakespeare.romeo} | 生成《罗密欧与朱丽叶》的随机引用 | O Romeo, Romeo! wherefore art thou Romeo? |
Sip
表达式 | 描述 | 示例输出 |
---|---|---|
#{sip.method} | 生成SIP方法 | INVITE |
#{sip.responseCode} | 生成SIP响应代码 | 200 |
Size
表达式 | 描述 | 示例输出 |
---|---|---|
#{size.adjective} | 生成大小形容词 | Small |
#{size.noun} | 生成大小名词 | Medium |
SoulKnight
表达式 | 描述 | 示例输出 |
---|---|---|
#{soulKnight.character} | 生成《元气骑士》角色 | Knight |
#{soulKnight.pet} | 生成《元气骑士》宠物 | Baby Dragon Bros |
#{soulKnight.buff} | 生成《元气骑士》增益 | Fire Immunity |
Space
表达式 | 描述 | 示例输出 |
---|---|---|
#{space.planet} | 生成行星 | Mars |
#{space.moon} | 生成卫星 | Europa |
#{space.galaxy} | 生成星系 | Andromeda |
#{space.nebula} | 生成星云 | Orion Nebula |
#{space.star} | 生成恒星 | Betelgeuse |
#{space.agency} | 生成航天机构 | NASA |
#{space.company} | 生成航天公司 | SpaceX |
#{space.constellation} | 生成星座 | Orion |
#{space.distanceMeasurement} | 生成距离测量 | Light Year |
#{space.meteorite} | 生成陨石 | Hoba |
#{space.nasaSpaceMission} | 生成NASA太空任务 | Apollo 11 |
StarCraft
表达式 | 描述 | 示例输出 |
---|---|---|
#{starCraft.unit} | 生成《星际争霸》单位 | Marine |
#{starCraft.building} | 生成《星际争霸》建筑 | Command Center |
#{starCraft.character} | 生成《星际争霸》角色 | Jim Raynor |
#{starCraft.planet} | 生成《星际争霸》行星 | Char |
StarTrek
表达式 | 描述 | 示例输出 |
---|---|---|
#{starTrek.character} | 生成《星际迷航》角色 | Captain Kirk |
#{starTrek.location} | 生成《星际迷航》地点 | Starfleet Academy |
#{starTrek.specie} | 生成《星际迷航》物种 | Vulcan |
#{starTrek.villain} | 生成《星际迷航》反派 | Khan |
Stock
表达式 | 描述 | 示例输出 |
---|---|---|
#{stock.nsdqSymbol} | 生成纳斯达克股票代码 | AAPL |
#{stock.nyseSymbol} | 生成纽约证券交易所股票代码 | IBM |
Subscription
表达式 | 描述 | 示例输出 |
---|---|---|
#{subscription.plan} | 生成订阅计划 | Premium |
#{subscription.status} | 生成订阅状态 | Active |
#{subscription.term} | 生成订阅期限 | Monthly |
#{subscription.paymentMethod} | 生成支付方式 | Credit Card |
Superhero
表达式 | 描述 | 示例输出 |
---|---|---|
#{superhero.name} | 生成超级英雄名称 | Spider-Man |
#{superhero.prefix} | 生成超级英雄前缀 | Captain |
#{superhero.suffix} | 生成超级英雄后缀 | Man |
#{superhero.power} | 生成超能力 | Wall-crawling |
#{superhero.descriptor} | 生成超级英雄描述词 | Amazing |
SuperMario
表达式 | 描述 | 示例输出 |
---|---|---|
#{superMario.character} | 生成《超级马里奥》角色 | Mario |
#{superMario.game} | 生成《超级马里奥》游戏 | Super Mario Bros. |
#{superMario.location} | 生成《超级马里奥》地点 | Mushroom Kingdom |
Tea
表达式 | 描述 | 示例输出 |
---|---|---|
#{tea.type} | 生成茶类型 | Green Tea |
#{tea.variety} | 生成茶品种 | Sencha |
Team
表达式 | 描述 | 示例输出 |
---|---|---|
#{team.name} | 生成团队名称 | Red Lions |
#{team.creature} | 生成团队生物 | Lions |
#{team.state} | 生成团队所在州 | California |
#{team.sport} | 生成团队运动项目 | Basketball |
TheItCrowd
表达式 | 描述 | 示例输出 |
---|---|---|
#{theItCrowd.characters} | 生成《IT狂人》角色 | Roy Trenneman |
#{theItCrowd.quotes} | 生成《IT狂人》名言 | Have you tried turning it off and on again? |
#{theItCrowd.emails} | 生成《IT狂人》邮件 | subject.fire@reynholm.test |
Time
表达式 | 描述 | 示例输出 |
---|---|---|
#{time.hour} | 生成小时 | 15 |
#{time.minute} | 生成分钟 | 30 |
#{time.period} | 生成时间段 | PM |
Touhou
表达式 | 描述 | 示例输出 |
---|---|---|
#{touhou.character} | 生成《东方Project》角色 | Reimu Hakurei |
#{touhou.location} | 生成《东方Project》地点 | Hakurei Shrine |
Tron
表达式 | 描述 | 示例输出 |
---|---|---|
#{tron.character} | 生成《创:战纪》角色 | Kevin Flynn |
#{tron.game} | 生成《创:战纪》游戏 | Disc Wars |
#{tron.location} | 生成《创:战纪》地点 | The Grid |
#{tron.quote} | 生成《创:战纪》名言 | I fight for the users! |
#{tron.tagline} | 生成《创:战纪》标语 | A world inside the computer where man has never been. |
#{tron.vehicle} | 生成《创:战纪》载具 | Light Cycle |
TwinPeaks
表达式 | 描述 | 示例输出 |
---|---|---|
#{twinPeaks.character} | 生成《双峰》角色 | Dale Cooper |
#{twinPeaks.location} | 生成《双峰》地点 | Black Lodge |
#{twinPeaks.quote} | 生成《双峰》台词 | Damn fine coffee! |
表达式 | 描述 | 示例输出 |
---|---|---|
#{twitter.hashtag} | 生成Twitter话题标签 | #love |
#{twitter.userId} | 生成Twitter用户ID | @example |
University
表达式 | 描述 | 示例输出 |
---|---|---|
#{university.name} | 生成大学名称 | Stanford University |
#{university.prefix} | 生成大学前缀 | Northern |
#{university.suffix} | 生成大学后缀 | Institute of Technology |
Vehicle
表达式 | 描述 | 示例输出 |
---|---|---|
#{vehicle.vin} | 生成车辆识别码 | 1HGCM82633A123456 |
#{vehicle.manufacturer} | 生成车辆制造商 | Toyota |
#{vehicle.model} | 生成车辆型号 | Camry |
#{vehicle.make} | 生成车辆品牌 | Volkswagen |
#{vehicle.fuel} | 生成车辆燃料类型 | Gasoline |
#{vehicle.type} | 生成车辆类型 | Sedan |
#{vehicle.color} | 生成车辆颜色 | Red |
#{vehicle.licensePlate} | 生成车牌号码 | ABC-123 |
Volleyball
表达式 | 描述 | 示例输出 |
---|---|---|
#{volleyball.team} | 生成排球队 | Brazil National Team |
#{volleyball.player} | 生成排球运动员 | Karch Kiraly |
#{volleyball.position} | 生成排球位置 | Setter |
#{volleyball.formation} | 生成排球阵型 | 5-1 |
Weather
表达式 | 描述 | 示例输出 |
---|---|---|
#{weather.description} | 生成天气描述 | Partly cloudy |
#{weather.temperature 'scale'} | 生成温度 | 25°C |
#{weather.pressure} | 生成气压 | 1013 hPa |
#{weather.temperatureCelsius} | 生成摄氏温度 | 25°C |
#{weather.temperatureFahrenheit} | 生成华氏温度 | 77°F |
Witcher
表达式 | 描述 | 示例输出 |
---|---|---|
#{witcher.character} | 生成《巫师》角色 | Geralt of Rivia |
#{witcher.location} | 生成《巫师》地点 | Novigrad |
#{witcher.monster} | 生成《巫师》怪物 | Leshen |
#{witcher.quote} | 生成《巫师》名言 | Evil is evil. Lesser, greater, middling… |
#{witcher.school} | 生成《巫师》学派 | School of the Wolf |
#{witcher.witcher} | 生成《巫师》猎魔人 | Geralt of Rivia |
Yoda
表达式 | 描述 | 示例输出 |
---|---|---|
#{yoda.quote} | 生成尤达大师名言 | Do or do not, there is no try. |
Zelda
表达式 | 描述 | 示例输出 |
---|---|---|
#{zelda.character} | 生成《塞尔达传说》角色 | Link |
#{zelda.game} | 生成《塞尔达传说》游戏 | Breath of the Wild |
#{zelda.location} | 生成《塞尔达传说》地点 | Hyrule Castle |
#{zelda.item} | 生成《塞尔达传说》物品 | Master Sword |
基本字符串生成方法
方法 | 描述 | 示例调用 | 示例输出 | 参数说明 |
---|---|---|---|---|
numerify(String numberString) | 将字符串中的 # 替换为随机数字 | faker.numerify("ABC##") | ABC25 | numberString: 包含 # 的模板字符串 |
letterify(String letterString) | 将字符串中的 ? The replaced with random alphabetic characters | faker.letterify("???") | XYZ | letterString: 包含 ? 的模板字符串 |
letterify(String letterString, boolean isUpper) | 将字符串中的 ? 替换为随机字母,可控制大小写 | faker.letterify("???", true) | XYZ | letterString: 包含 ? 的模板字符串 isUpper: 是否使用大写字母 |
bothify(String string) | 组合 numerify 和 letterify 功能,同时进行替换 | faker.bothify("??##") | AB12 | string: 包含 ? 和 # 的模板字符串 |
bothify(String string, boolean isUpper) | 组合 numerify 和 letterify 功能,可控制字母大小写 | faker.bothify("??##", true) | AB12 | string: 包含 ? 和 # 的模板字符串 isUpper: 是否使用大写字母 |
高级模板方法
方法 | 描述 | 示例调用 | 示例输出 | 参数说明 |
---|---|---|---|---|
regexify(String regex) | 生成符合正则表达式的字符串 | faker.regexify("[a-z]{5}") | abcde | regex: 正则表达式 |
examplify(String example) | 按照输入字符串的模式生成新字符串 | faker.examplify("ABC") | XYZ | example: 示例字符串,保持相同模式但内容不同 |
templatify(String string, char char2replace, String... options) | 用随机选项替换字符串中的指定字符 | faker.templatify("AB??", '?', "X", "Y") | ABXY | string: 模板字符串 char2replace: 要替换的字符 options: 可选的替换选项 |
templatify(String string, Map<Character, String[]> optionsMap) | 用随机选项替换字符串中的多个不同字符 | 见示例部分 | 见示例部分 | string: 模板字符串 optionsMap: 字符到可能替换项的映射 |
expression(String expression) | 执行 DataFaker 表达式 | faker.expression("#{Name.fullName}") | John Doe | expression: DataFaker 表达式字符串 |
数据结构生成方法
方法 | 描述 | 示例调用 | 示例输出 | 参数说明 |
---|---|---|---|---|
json(String... fieldExpressions) | 生成 JSON 对象 | faker.json("name", "#{Name.fullName}", "email", "#{Internet.email}") | {"name":"John Doe","email":"john.doe@example.com"} | fieldExpressions: JSON 字段名和值表达式的成对参数 |
jsona(String... fieldExpressions) | 生成 JSON 数组 | 见示例部分 | 见示例部分 | fieldExpressions: JSON 数组元素的表达式 |
csv(int limit, String... columnExpressions) | 生成 CSV 内容,使用默认的逗号分隔符 | faker.csv(2, "name", "#{Name.firstName}", "lastName", "#{Name.lastName}") | "name","lastName" "John","Smith" "Jane","Doe" | limit: 行数 columnExpressions: 列名和列值表达式的成对参数 |
csv(String separator, char quote, boolean withHeader, int limit, String... columnExpressions) | 生成自定义 CSV 内容 | faker.csv(" | ", '"', true, 2, "name", "#{Name.firstName}", "lastName", "#{Name.lastName}") | "name" | "lastName" "John" | "Smith" "Jane" | "Doe" | separator: 分隔符 quote: 引号字符 withHeader: 是否包含表头 limit: 行数 columnExpressions: 列名和列值表达式的成对参数 |
完整示例
基本字符串替换
Faker faker = new Faker();
// 数字替换
String phone = faker.numerify("###-###-####"); // 例如: "123-456-7890"
String code = faker.numerify("Product-####"); // 例如: "Product-1234"
// 字母替换
String letters = faker.letterify("????"); // 例如: "abcd"
String upperLetters = faker.letterify("????", true); // 例如: "ABCD"
// 混合替换
String mixed = faker.bothify("??##-??##"); // 例如: "ab12-cd34"
String mixedUpper = faker.bothify("??##-??##", true); // 例如: "AB12-CD34"
高级模板应用
Faker faker = new Faker();
// 正则表达式生成
String email = faker.regexify("[a-z]{5,8}@[a-z]{3,7}\\.(com|net|org)");
// 例如: "abcde@xyz.com"
// 模式复制
String copyPattern = faker.examplify("ABC-123-xyz");
// 结果将保持相同模式: 大写字母-数字-小写字母, 例如: "XYZ-789-klm"
// 模板替换 - 单个字符
String singleChar = faker.templatify("Choose: $", '$', "Option A", "Option B", "Option C");
// 例如: "Choose: Option B"
// 模板替换 - 多个字符
Map<Character, String[]> options = new HashMap<>();
options.put('$', new String[]{"$5", "$10", "$20"});
options.put('#', new String[]{"1", "2", "3"});
String multiChar = faker.templatify("Price: $ for # items", options);
// 例如: "Price: $10 for 2 items"
数据结构生成
Faker faker = new Faker();
// JSON 对象
Json person = faker.json(
"name", "#{Name.fullName}",
"age", "#{Number.numberBetween '18' '65'}",
"email", "#{Internet.emailAddress}",
"address", "#{Address.fullAddress}"
);
// 例如: {"name":"John Doe","age":30,"email":"john.doe@example.com","address":"123 Main St, Anytown, CA 12345"}
// JSON 数组
Json people = faker.jsona(
"#{json 'name','#{Name.fullName}','age','#{Number.numberBetween \"20\" \"50\"}'}",
"#{json 'name','#{Name.fullName}','age','#{Number.numberBetween \"20\" \"50\"}'}"
);
// 例如: [{"name":"John Doe","age":30},{"name":"Jane Smith","age":25}]
// 基本 CSV
String csvData = faker.csv(3,
"id", "#{Number.numberBetween '1000' '9999'}",
"name", "#{Name.fullName}",
"department", "#{Commerce.department}"
);
/* 例如:
"id","name","department"
"1234","John Doe","Electronics"
"5678","Jane Smith","Books"
"9012","Bob Johnson","Clothing"
*/
// 自定义 CSV
String customCsv = faker.csv(" | ", '\'', false, 2,
"name", "#{Name.fullName}",
"salary", "#{Number.numberBetween '50000' '100000'}"
);
/* 例如 (没有表头,使用单引号和自定义分隔符):
'John Doe' | '75000'
'Jane Smith' | '82000'
*/
表达式组合应用
Faker faker = new Faker();
// 使用表达式执行复杂组合
String complexTemplate = faker.expression("My name is #{Name.fullName}. " +
"I am #{Number.numberBetween '20' '65'} years old and work as a #{Job.title} " +
"in #{Address.city}, #{Address.stateAbbr}. " +
"You can reach me at #{Internet.emailAddress} or #{PhoneNumber.phoneNumber}.");
// 例如:
// "My name is John Smith. I am 34 years old and work as a Software Engineer in New York, NY.
// You can reach me at john.smith@example.com or (555) 123-4567."